package com.ygxsk.carhome.ui.archive;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.ClickUtils;
import com.blankj.utilcode.util.KeyboardUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.flyco.roundview.RoundTextView;
import com.gyf.immersionbar.ImmersionBar;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.XXPermissions;
import com.hjq.toast.Toaster;
import com.kongzue.dialogx.dialogs.PopTip;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.BasePopupView;
import com.park.keyboard.PopupKeyboard;
import com.trello.rxlifecycle4.android.ActivityEvent;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.runtime.Permission;
import com.ygxsk.carhome.R;
import com.ygxsk.carhome.alertview.AlertView;
import com.ygxsk.carhome.alertview.OnItemClickListener;
import com.ygxsk.carhome.configeng.GifSizeFilter;
import com.ygxsk.carhome.configeng.Glide4Engine;
import com.ygxsk.carhome.constant.ConstantApi;
import com.ygxsk.carhome.constant.ConstantSign;
import com.ygxsk.carhome.constant.ExtraKey;
import com.ygxsk.carhome.constant.ExtraValue;
import com.ygxsk.carhome.enumwrap.ArchiveVehicleType;
import com.ygxsk.carhome.enumwrap.LeadGender;
import com.ygxsk.carhome.event.EventLeadMain;
import com.ygxsk.carhome.greendao.CarBrandLargeCategoryDaoManager;
import com.ygxsk.carhome.greendao.CarBrandSeriesLineDaoManager;
import com.ygxsk.carhome.listener.AuthorityCallbackListener;
import com.ygxsk.carhome.listener.Delivery;
import com.ygxsk.carhome.listener.DoSomeThingListener;
import com.ygxsk.carhome.listener.ErrorParentExtraSingle;
import com.ygxsk.carhome.listener.GainDataCallBackListener;
import com.ygxsk.carhome.listener.MyArchiveFileAddSubmitListener;
import com.ygxsk.carhome.listener.MyArchiveFileCarInfoAddListener;
import com.ygxsk.carhome.listener.RxBus;
import com.ygxsk.carhome.permission.PermissionSetting;
import com.ygxsk.carhome.permission.RuntimeRationale;
import com.ygxsk.carhome.response.AgreenMentFileAddSubmit;
import com.ygxsk.carhome.response.ArchiveFileType;
import com.ygxsk.carhome.response.ArchiveType;
import com.ygxsk.carhome.response.ArchivesManageFileVo;
import com.ygxsk.carhome.response.CarBrandLargeCategory;
import com.ygxsk.carhome.response.CarBrandSeriesLineSmallCategory;
import com.ygxsk.carhome.response.EvaluateWadeInfo;
import com.ygxsk.carhome.response.FileCarInfoAddSubmit;
import com.ygxsk.carhome.response.FileCarInfoAddSubmitUpLoad;
import com.ygxsk.carhome.response.FileSingleUpLoadBean;
import com.ygxsk.carhome.response.FileUpLoad;
import com.ygxsk.carhome.response.InformationAccessoryUpLoad;
import com.ygxsk.carhome.response.LeadListItemBean;
import com.ygxsk.carhome.response.LeadsGenderInfoBean;
import com.ygxsk.carhome.retrofit.AddLogUpLoadInfo;
import com.ygxsk.carhome.retrofit.ApiException;
import com.ygxsk.carhome.retrofit.ApiRequestSubListener;
import com.ygxsk.carhome.retrofit.ApiService;
import com.ygxsk.carhome.retrofit.ErrorConsumer;
import com.ygxsk.carhome.retrofit.NetworkManager;
import com.ygxsk.carhome.retrofit.ResponseTransformer;
import com.ygxsk.carhome.rxbus.RxBusCalendarTimeForAgreement;
import com.ygxsk.carhome.rxbus.RxBusCarBrand;
import com.ygxsk.carhome.rxbus.RxBusCarSeriesLineSmall;
import com.ygxsk.carhome.rxbus.RxBusCarWadeForAgreement;
import com.ygxsk.carhome.rxbus.RxBusGender;
import com.ygxsk.carhome.rxbus.RxBusLeadMember;
import com.ygxsk.carhome.sys.PermissionNameConvert;
import com.ygxsk.carhome.ui.ErrorActivity;
import com.ygxsk.carhome.ui.adapter.AgreenMentFileAdapter;
import com.ygxsk.carhome.ui.adapter.ArchiveFileCarInfoAddSubmitAdapter;
import com.ygxsk.carhome.ui.evaluate.CalendarViewCustomPopup;
import com.ygxsk.carhome.ui.evaluate.EvaluateWadePopu;
import com.ygxsk.carhome.ui.leads.LeadsCarBrandLargeCategorySelectPopu;
import com.ygxsk.carhome.ui.leads.LeadsCarBrandSeriesLineSmalCategorySelectPopu;
import com.ygxsk.carhome.ui.leads.LeadsGenderSelectPopu;
import com.ygxsk.carhome.utils.CommUtils;
import com.ygxsk.carhome.utils.VehiclePlateNoUtil;
import com.ygxsk.carhome.utils.ViewUitls;
import com.ygxsk.carhome.views.ClearEditTextTouch;
import com.ygxsk.carhome.views.MyLinearLayoutManager;
import com.ygxsk.integrated.retrofit.Parameterkey;
import com.zhongjh.albumcamerarecorder.album.filter.BaseFilter;
import com.zhongjh.albumcamerarecorder.preview.BasePreviewActivity;
import com.zhongjh.albumcamerarecorder.settings.AlbumSetting;
import com.zhongjh.albumcamerarecorder.settings.CameraSetting;
import com.zhongjh.albumcamerarecorder.settings.GlobalSetting;
import com.zhongjh.albumcamerarecorder.settings.MultiMediaSetting;
import com.zhongjh.common.entity.LocalFile;
import com.zhongjh.common.entity.MediaExtraInfo;
import com.zhongjh.common.entity.MultiMedia;
import com.zhongjh.common.entity.SaveStrategy;
import com.zhongjh.common.enums.MimeType;
import com.zhongjh.common.utils.MediaUtils;
import com.zhongjh.progresslibrary.entity.MultiMediaView;
import com.zhongjh.progresslibrary.listener.MaskProgressLayoutListener;
import com.zhongjh.progresslibrary.widget.MaskProgressLayout;

import org.greenrobot.eventbus.EventBus;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.functions.Action;
import io.reactivex.rxjava3.functions.BiFunction;
import io.reactivex.rxjava3.functions.Consumer;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

/*
 * @Author:itchenqi175@163.com
 * @Time:2023-07-28  17:12
 * @Description:添加档案 大表单
 */
public class ArchiveFileAddSubmitActivity extends ErrorActivity implements ErrorParentExtraSingle {

    @BindView(R.id.layoutbutton_file_submit)
    RoundTextView layoutButton_file_submit;

    @BindView(R.id.recyclerviewagreenment)
    RecyclerView recyclerViewAgreenMent;

    //客户姓名
    private ClearEditTextTouch editView_customer_name;
    //年龄
    private ClearEditTextTouch editView_customer_years;
    //客户的性别
    private TextView textview_customer_sex;

    //手机号
    private ClearEditTextTouch editView_customer_phone;

    //微信号
    private ClearEditTextTouch editView_customer_wechart;

    //客户的邮箱
    private ClearEditTextTouch editView_customer_email;

    //客户的地址
    private ClearEditTextTouch editView_customer_address;
    //客户的公司
    private ClearEditTextTouch editView_customer_company;
    //职位信息 也即是工作信息
    private ClearEditTextTouch editView_customer_job;

    //--------------------------------------------------------
    //车辆的品牌
//    TextView textVieweCarBrandModel;
    //车系的文本填充
//    TextView textViewCarModelSecond;
    //车辆车型是手动输入
//    ClearEditTextTouch editViewCarModel;
    //新能源的车牌内容
//    ImageView imgIconInmMiddle;
    //车牌号
//    ClearEditTextTouch editViewCarCard;

    //车架号
//    ClearEditTextTouch editViewCarFrame;
    //发动机号
//    ClearEditTextTouch editViewCarMotor;
    //--------------------------------------------------------

    //客户信息-------------------------------------------------
    //上传需要的提供信息 10 个基础信息
    //上传需要的姓名
    private String clientName_upLoad = "";
    //需要上传的身份信息
    private String idCard_upLoad = "";
    //上传需要的性别
    private String gender_upLoad = "";
    //年龄信息
    private String age_upLoad = "";
    //需要上传的手机号信息
    private String phone_upLoad = "";
    //客户的微信号信息
    private String wechatNumber_upLoad = "";
    //客户的邮件信息
    private String email_upLoad = "";
    //客户的地址信息
    private String address_upLoad = "";
    //客户的公司信息
    private String companyDetail_upLoad = "";
    //客户的职位信息
    private String position_upLoad = "";

    private ClientManageSingleUpLoad clientManage_upLoad = new ClientManageSingleUpLoad();

    //车辆信息-------------------------------------------------
    //车架号
    private String vin_upLoad = "";
    //车牌号
    private String licenseNumber_upLoad = "";
    // TODO: 2023-08-13 17:30 车辆类型是啥？新车二手车？
    //车辆类型
    private String vehicleType_upLoad = "";
    //车辆品牌,不能用了，改为了多车辆
//    private String carBranch_upLoad = "";
    //车辆车系
//    private String carSeries_upLoad = "";
    //车辆型号
    private String carModel_upLoad = "";
    //车辆发动机号
    private String engineNum_upLoad = "";
    //车辆信息--end-----------------------------------------------


    //列表内的合同信息-----------------------------------------------
//    private ArrayList<ArchivesManageSingleUpLoad> archivesManageList = new ArrayList<>();

    //档案附件信息-----------------------------------------------
    //上传档案 附件 的而信息
//    private ArrayList<InformationAccessorySingleUpLoad> informationAccessoryList_upLoad = new ArrayList<InformationAccessorySingleUpLoad>();

    private PermissionSetting mSetting;

    protected static final int REQUEST_CODE_CHOOSE = 236;
    //底部的视图打开相机相册的内容
    protected static final int REQUEST_CODE_CHOOSE_FOOTERVIEW = 2361;

    //携带有图片监听器的该条目
    private AgreenMentFileAddSubmit agreenMentFileAddSubmitItemWithMaskListener;

    //底部的一个帮助布局
//    @BindView(R.id.textviewinarchivebottomhelp)
//    TextView textViewInArchiveBottomHelp;

    //界面的id的默认的序号的编号:默认是1
    private int identifierNumber = 0;
    //对于车辆的信息的添加
    private int identifierNumber_carInfo = 0;

    //添加 文件提交的车辆信息字信息
    private ArrayList<FileCarInfoAddSubmit> mDataResourceCars = new ArrayList<>();

    //页面填充的适配器；
    private ArrayList<AgreenMentFileAddSubmit> mDataResources = new ArrayList<>();
    //一个临时的添加车辆 品牌列表
    private ArrayList<CarBrandLargeCategory> mDataResources_carBrandLarge = new ArrayList<>();
    //携带动态配置的附件的内容过来
    private ArrayList<ArchiveFileType> mDataResources_archiveFile = new ArrayList<>();

    //默认的第一条车牌数据，要填充到所有添加车辆的第一条
    private CarBrandLargeCategory carBrandLargeCategory_defaultOne;

    //一个临时的车系内容
    private ArrayList<CarBrandSeriesLineSmallCategory> mDataResources_carBrandSeriesList = new ArrayList<>();
    //获取档案管理的类型:合同的类型，这是做转换之后的，要弹窗的
    private ArrayList<EvaluateWadeInfo> mDataResources_archiveTypeList_forPopu = new ArrayList<>();
    //获取年龄的信息列表
    private ArrayList<LeadsGenderInfoBean> mDataResources_genderType = new ArrayList<>();

    //外侧的大的合同的添加适配器；
    private AgreenMentFileAdapter agreenMentFileAdapter;

    //添加车辆的适配器信息内容
    private ArchiveFileCarInfoAddSubmitAdapter archiveFileCarInfoAddSubmitAdapter;
    //适配器之中的接口监听器
    private MyArchiveFileCarInfoAddListener myArchiveFileCarInfoAddListener;

    //弹窗的车辆品牌
    private BasePopupView basePopupView_carBrandLargeCategory;
    //选择车系的弹窗
    private BasePopupView basePopupView_carBrandSeriesSmallCategory;

    //获取性别的弹窗内容
    private BasePopupView basePopupViewGender;
    //弹窗关于签约时间的
    private BasePopupView basePopupViewAgreenmentTime;
    //选择合同的类型
    private BasePopupView basePopupView_agreeMentType;

    //private ArrayList<FileUpLoad> fileSingleUpLoadFiles_attachment_address_hashMap = new ArrayList();
    //底部的附件承诺函等信息的附件上传；涉及到图片的编辑，使用HashMap
    //底部动态档案附件的内容应该设计是：一个键值对，键是这个类型 fileTypeName，fileType
//  private ArrayList<HashMap<String, ArrayList<HashMap<String,Object>>>> fileSingleUpLoadFiles_attachment_address_hashMap_dynamics = new ArrayList<>();
    private ArrayList<HashMap<String, Object>> fileSingleUpLoadFiles_attachment_address_hashMap_dynamics = new ArrayList<>();

//    private ArrayList<ArchiveFileType> mData_archiveFiles = new ArrayList<>();

    // TODO: 2024/2/22 10:32 将来要去掉这个变量，暂时保留为了代码不报错
    //底部视图的档案附件的图片预览展示； footerView之中的添加档案
//    private MaskProgressLayout mplimageListInArchiveCheckFooterView;

    //底部的携带九宫格的这条实体的传递 监听主要用在 onActivityResult 之中处理图片的添加和删除；
    private ArchiveFileType footerArchiveFileTypeWithMaskListener;

    //footerView之中的底部九宫格的适配器
    private FooterModifyAddSubmitArchiveFileTypeAdapter footerModifyAddSubmitArchiveFileTypeAdapter;

    //底部视图的获得
    private GlobalSetting mGlobalSettingFooterView;
    //添加该页面的设置内容；
    private GlobalSetting mGlobalSetting;
    //该界面之中对于所有列表相机的监听
    private MyMaskProgressLayoutListener myMaskProgressLayoutListener;
    //底部的通用的监听器
//    private MyFooterMaskProgressLayoutListener myFooterMaskProgressLayoutListener;

    //车牌录入的软键盘
    private PopupKeyboard mPopupKeyboard;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivityInstance = this;

        if (mDataResources_genderType == null) {
            mDataResources_genderType = new ArrayList<>();
        }

        if (mDataResources_archiveTypeList_forPopu == null) {
            mDataResources_archiveTypeList_forPopu = new ArrayList<>();
        }

        if (mDataResources_carBrandSeriesList != null) {
            mDataResources_carBrandSeriesList = new ArrayList<>();
        }

        if (mDataResources_carBrandLarge != null) {
            mDataResources_carBrandLarge = new ArrayList<>();
        }

        if (agreenMentFileAddSubmitItemWithMaskListener == null) {
            agreenMentFileAddSubmitItemWithMaskListener = new AgreenMentFileAddSubmit();
        }

        //当前适配器的九宫格监听器
        if (myMaskProgressLayoutListener == null) {
            myMaskProgressLayoutListener = new MyMaskProgressLayoutListener();
        }

//        if (myFooterMaskProgressLayoutListener == null) {
//            myFooterMaskProgressLayoutListener = new MyFooterMaskProgressLayoutListener();
//        }

        //尽量不让替换类为空
        if (footerArchiveFileTypeWithMaskListener == null) {
            footerArchiveFileTypeWithMaskListener = new ArchiveFileType();
        }

        //底部footerview的总的档案等附件文件
        if (fileSingleUpLoadFiles_attachment_address_hashMap_dynamics == null) {
            fileSingleUpLoadFiles_attachment_address_hashMap_dynamics = new ArrayList<>();
        }

        //创建车辆添加的选择器内容；
        myArchiveFileCarInfoAddListener = new SubMyArchiveFileCarInfoAddListener();

        processExtraData();

        initloading();

        initViews();

        gainDatas();

        //初始化相机
        initConfig();

        //监听单个客户内容
        //列表之内需要向外部广播数据
//        if (!EventBus.getDefault().isRegistered(this)) {
//            EventBus.getDefault().register(this);
//        }

        //监听合同类型
        mCompositeDisposable.add(RxBus.getInstance()
                .toObserverable(RxBusCarWadeForAgreement.class)//
                .subscribeOn(AndroidSchedulers.mainThread())//
                .observeOn(AndroidSchedulers.mainThread())//
                .subscribe(new Consumer<RxBusCarWadeForAgreement>() {

                    @Override
                    public void accept(RxBusCarWadeForAgreement rxBusCarWadeForAgreement) throws Throwable {

                        if (rxBusCarWadeForAgreement != null) {

                            if (rxBusCarWadeForAgreement.getActionFlag() == ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TYPE_SELECT) {//选择合同的类型；
                                //类型的id
                                String archiveTypeId_upLoad = rxBusCarWadeForAgreement.getEvaluateWadeInfo().getDictCode();
                                //类型的文本
                                String archiveTypeInfo_upLoad = rxBusCarWadeForAgreement.getEvaluateWadeInfo().getDictLabel();

                                //判断用户有没有选中信息，若
                                //if (TextUtils.isEmpty(archiveTypeId_upLoad)||TextUtils.isEmpty(archiveTypeInfo_upLoad)) {
                                if (TextUtils.isEmpty(archiveTypeId_upLoad)) {
                                    //选择时间异常，请重新选择；
                                    CommUtils.checkDialog(mAlertView);
                                    mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.typeisnullchoosesubmit), true);
                                    mAlertView.show();
                                    return;
                                }

                                if (agreenMentFileAdapter != null) {

                                    if (rxBusCarWadeForAgreement.getAgreenMentFileAddSubmit() != null) {

                                        int indexPosition = agreenMentFileAdapter.getItemPosition(rxBusCarWadeForAgreement.getAgreenMentFileAddSubmit()) + agreenMentFileAdapter.getHeaderLayoutCount();
                                        rxBusCarWadeForAgreement.getAgreenMentFileAddSubmit().setAgreenType(archiveTypeId_upLoad);
                                        //直接填充合同的类型
                                        rxBusCarWadeForAgreement.getAgreenMentFileAddSubmit().setEvaluateWadeInfo(rxBusCarWadeForAgreement.getEvaluateWadeInfo());

                                        //这种方式也可以
                                        TextView textViewFileAgreenTypeNameAdapter = (TextView) agreenMentFileAdapter.getViewByPosition(indexPosition, R.id.textviewfileagreennameadapter);

                                        if (textViewFileAgreenTypeNameAdapter != null) {
                                            textViewFileAgreenTypeNameAdapter.post(new Runnable() {
                                                @Override
                                                public void run() {
                                                    CommUtils.setText(textViewFileAgreenTypeNameAdapter, archiveTypeInfo_upLoad);
                                                }
                                            });

                                        } else {
                                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充合同-合同类型-textViewFileAgreenTypeNameAdapter--是空值");
                                        }
                                    } else {
                                        //执行异常：
                                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充合同-这一条合同-rxBusCarWadeForAgreement.getAgreenMentFileAddSubmit()--是空值");

                                        ToastUtils.showShort(StringUtils.getString(R.string.action_abnormal));

                                    }

                                }


                            }
                        }
                    }
                }));

        //监听选中的签约时间
        mCompositeDisposable.add(RxBus.getInstance()
                .toObserverable(RxBusCalendarTimeForAgreement.class)//
                .subscribeOn(AndroidSchedulers.mainThread())//
                .observeOn(AndroidSchedulers.mainThread())//
                .subscribe(new Consumer<RxBusCalendarTimeForAgreement>() {

                    @Override
                    public void accept(RxBusCalendarTimeForAgreement rxBusCalendarTimeForAgreement) throws Throwable {

                        if (rxBusCalendarTimeForAgreement != null) {

                            if (rxBusCalendarTimeForAgreement.getActionFlag() == ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TIME_SELECT) {

                                //【筛选是签约时间】；
                                String agreeMentTimeSelect = rxBusCalendarTimeForAgreement.getManufactureDate();
//                                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "agreeMentTimeSelect-->" + agreeMentTimeSelect);

                                if (TextUtils.isEmpty(agreeMentTimeSelect)) {
                                    //选择时间异常，请重新选择；
                                    CommUtils.checkDialog(mAlertView);
                                    mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.timeisnullchoosesubmit), true);
                                    mAlertView.show();
                                    return;
                                }

                                //判断适配器，从适配器之中取值textView赋值
                                if (agreenMentFileAdapter != null) {

                                    if (rxBusCalendarTimeForAgreement.getAgreenMentFileAddSubmitCurrent() != null) {

                                        int indexPosition = agreenMentFileAdapter.getItemPosition(rxBusCalendarTimeForAgreement.getAgreenMentFileAddSubmitCurrent()) + agreenMentFileAdapter.getHeaderLayoutCount();
                                        //给该条数据设置这个时间；
                                        rxBusCalendarTimeForAgreement.getAgreenMentFileAddSubmitCurrent().setAgreenTime(agreeMentTimeSelect);

                                        //这种方式也可以
                                        TextView textViewAgreementDate = (TextView) agreenMentFileAdapter.getViewByPosition(indexPosition, R.id.textviewagreentimeadapter);

                                        if (textViewAgreementDate != null) {
                                            textViewAgreementDate.post(new Runnable() {
                                                @Override
                                                public void run() {
                                                    CommUtils.setText(textViewAgreementDate, agreeMentTimeSelect);
                                                }
                                            });
                                        } else {
//                                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充中高风险--textViewStartDate--对象空指针");
                                        }
                                    }

                                }

                            }
                        }
                    }
                }));

        //监听选中的潜客信息，填充到客户信息之中
        mCompositeDisposable.add(RxBus.getInstance()
                .toObserverable(RxBusLeadMember.class)//
                .subscribeOn(AndroidSchedulers.mainThread())//
                .observeOn(AndroidSchedulers.mainThread())//
                .subscribe(new Consumer<RxBusLeadMember>() {

                    @Override
                    public void accept(RxBusLeadMember rxBusLeadMember) throws Throwable {

                        if (rxBusLeadMember != null) {

                            if (rxBusLeadMember.getActionFlag() == ExtraValue.RXBUS_ARCHIVE_CUSTOMER_FORM_LEADSMEMBER) {//选中的潜客信息；

                                //最低程度要判断这个潜客的姓名信息，

                                LeadListItemBean leadListItemBean = rxBusLeadMember.getLeadListItemBean();

                                if (leadListItemBean != null) {

                                    String customerName = leadListItemBean.getCustomerName();

                                    if (TextUtils.isEmpty(customerName)) {
                                        CommUtils.checkDialog(mAlertView);
                                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.type_customer_info_null), true);
                                        mAlertView.show();
                                        return;
                                    }

//                                    this.addForm.clientManage.clientName = customer && customer.customerName;
//                                    this.addForm.clientManage.phone = customer && customer.customerPhone;
//                                    this.addForm.clientManage.age = customer && customer.age;
//                                    this.addForm.clientManage.gender = customer && customer.memberSex;
//                                    this.addForm.clientManage.wechatNumber = customer && customer.weChat;

                                    //客户的手机号
                                    String customerPhone = leadListItemBean.getCustomerPhone();
                                    //客户的年龄
                                    String ageNumber = String.valueOf(leadListItemBean.getAgeNum());
                                    //客户微信号信息
                                    String weChat = leadListItemBean.getWeChat();
                                    //客户性别
                                    String memberSex = String.valueOf(leadListItemBean.getMemberSex());
                                    //邮箱信息
//                                    String


                                    //直接字段的填充逻辑
                                    Delivery.getInstance().post(new Runnable() {
                                        @Override
                                        public void run() {

                                            //--------------------------------------------------------------------------------
                                            //客户姓名
                                            if (editView_customer_name != null) {
                                                editView_customer_name.setText(customerName);
                                            }

                                            //--------------------------------------------------------------------------------

                                            //客户手机号
                                            if (editView_customer_phone != null) {
                                                editView_customer_phone.setText(customerPhone);
                                            }

                                            //--------------------------------------------------------------------------------

                                            //客户年龄
                                            if (editView_customer_years != null) {
                                                editView_customer_years.setText(ageNumber);
                                            }

                                            //--------------------------------------------------------------------------------
                                            //客户性别
                                            if (TextUtils.equals(memberSex, LeadGender.LEAD_GENDER_MEN.getIndex())) {
                                                if (textview_customer_sex != null) {
                                                    textview_customer_sex.setText(LeadGender.LEAD_GENDER_MEN.getValue());
                                                }
                                            } else if (TextUtils.equals(memberSex, LeadGender.LEAD_GENDER_WOMEN.getIndex())) {
                                                if (textview_customer_sex != null) {
                                                    textview_customer_sex.setText(LeadGender.LEAD_GENDER_WOMEN.getValue());
                                                }
                                            } else if (TextUtils.equals(memberSex, LeadGender.LEAD_GENDER_UNKNOW.getIndex())) {
                                                if (textview_customer_sex != null) {
                                                    textview_customer_sex.setText(LeadGender.LEAD_GENDER_UNKNOW.getValue());
                                                }
                                            }
                                            //--------------------------------------------------------------------------------

                                            //填充微信信息
                                            if (editView_customer_wechart != null) {
                                                editView_customer_wechart.setText(weChat);
                                            }

                                            //--------------------------------------------------------------------------------
                                            //邮箱信息

                                            //--------------------------------------------------------------------------------
                                            //--------------------------------------------------------------------------------
                                            //--------------------------------------------------------------------------------


                                        }
                                    });

                                } else {

                                    // TODO: 2024/2/21 17:09 提示携带信息是空值
                                    ToastUtils.showShort(getResources().getString(R.string.type_customer_info_null));

                                }

                            }
                        }
                    }
                }));


        //【保存按钮】按钮点击
        if (layoutButton_file_submit != null) {
            layoutButton_file_submit.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    //数据填充的各种校验
                    //客户信息
                    clientName_upLoad = editView_customer_name.getText().toString().trim();
                    //客户的证件号 是可以为空的 idCard
                    idCard_upLoad = "";
                    //客户的性别--是上传性别的id信息；
                    //gender_upLoad = textview_customer_sex.getText().toString().trim();
                    //客户的年龄
                    age_upLoad = editView_customer_years.getText().toString().trim();
                    //客户的手机号
                    phone_upLoad = editView_customer_phone.getText().toString().trim();
                    //客户的微信号
                    wechatNumber_upLoad = editView_customer_wechart.getText().toString().trim();
                    //客户的邮箱信息
                    email_upLoad = editView_customer_email.getText().toString().trim();
                    //客户的地址信息
                    address_upLoad = editView_customer_address.getText().toString().trim();
                    //客户额公司信息
                    companyDetail_upLoad = editView_customer_company.getText().toString().trim();
                    //客户的职位信息
                    position_upLoad = editView_customer_job.getText().toString().trim();

                    //可以直接填充客户信息
                    if (clientManage_upLoad == null) {
                        clientManage_upLoad = new ClientManageSingleUpLoad();
                    }

                    clientManage_upLoad.setClientName(clientName_upLoad);
                    clientManage_upLoad.setIdCard(idCard_upLoad);
                    clientManage_upLoad.setGender(gender_upLoad);
                    clientManage_upLoad.setAge(age_upLoad);
                    clientManage_upLoad.setPhone(phone_upLoad);
                    clientManage_upLoad.setWechatNumber(wechatNumber_upLoad);
                    clientManage_upLoad.setEmail(email_upLoad);
                    clientManage_upLoad.setAddress(address_upLoad);
                    clientManage_upLoad.setCompanyDetail(companyDetail_upLoad);
                    clientManage_upLoad.setPosition(position_upLoad);

                    //--------------------------------------------------------------------------------------------------
                    // TODO: 2023-11-07 17:49 应该是循环遍历内容，但是默认 是新车类型，写成死的
                    //车辆类型,默认传递1，是新车类型
                    vehicleType_upLoad = ArchiveVehicleType.VEHICLETYPE_CAR_NEW.getIndex();

                    //车辆的品牌--仅仅上传品牌的id即可
                    //carBranch_upLoad = ;
                    //车辆的车系--仅仅上传车辆车系id
                    //carSeries_upLoad  = ""
//                    //车型
//                    carModel_upLoad = editViewCarModel.getText().toString().trim();
//                    //车牌号
//                    licenseNumber_upLoad = editViewCarCard.getText().toString().trim();
//                    //车架号
//                    vin_upLoad = editViewCarFrame.getText().toString().trim();
//                    //发动机号
//                    engineNum_upLoad = editViewCarMotor.getText().toString().trim();

                    //--------------------------------------------------------------------------------------------------
                    //做必填项的信息校验
                    //校验客户姓名
                    if (TextUtils.isEmpty(clientName_upLoad)) {//服务站运营经理的初始值-1说明没有赋值，提交不过去
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.check_customername_upload), true);
                        mAlertView.show();
                        return;
                    }

                    //校验客户的手机号
                    if (TextUtils.isEmpty(phone_upLoad)) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.check_customerphone_upload), true);
                        mAlertView.show();
                        return;
                    }

                    //-----------------------------------------------------------

                    //校验车辆的内容，如果是单个的
                    //--------------------------------------------------------------------------------------------------
                    ArrayList<FileCarInfoAddSubmitUpLoad> fileCarInfoAddSubmit_out_list_upLoad = new ArrayList<>();
                    //要标记哪个车牌是空的？存储车牌用到的
                    ArrayList<HashMap<String, FileCarInfoAddSubmit>> fileCarInfoAddSubmit_out_licenseNumber = new ArrayList<>();
                    //记录校验有空的值内容

                    //车辆品牌有空的
                    boolean carBranch_hasNull = false;
                    //车辆车系有空值
                    boolean carSeriesId_hasNull = false;
                    //车辆车型有空值
                    boolean carModelName_hasNull = false;
                    //车辆车架号有空值
                    boolean vin_hasNull = false;

                    //车辆车发动机号有空值--是非必填不用过滤
//                    boolean engineNum_hasNull = false;
                    //车辆车牌号--是非必填不用过滤-如果没填写就放过，如果真的填写了车牌，就要校验车牌的正确性
                    boolean licenseNumber_hasNotNull = false;

                    Iterator<FileCarInfoAddSubmit> iterator = mDataResourceCars.iterator();

                    if (iterator != null) {

                        while (iterator.hasNext()) {

                            FileCarInfoAddSubmitUpLoad fileCarInfoAddSubmitUpLoad = new FileCarInfoAddSubmitUpLoad();

                            FileCarInfoAddSubmit fileCarInfoAddSubmit = iterator.next();

//                            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "即将上传的车辆是", (fileCarInfoAddSubmit));

                            if (fileCarInfoAddSubmit != null) {

                                //车辆品牌-主要验证品牌id
                                String carBranch = fileCarInfoAddSubmit.getCarBranchId();
                                //车系 -主要验证车系的id
                                String carSeriesId = fileCarInfoAddSubmit.getCarSeriesId();
                                //车型是录入的
                                String carModelName = fileCarInfoAddSubmit.getCarModelName();
                                //车架号
                                String vin = fileCarInfoAddSubmit.getVin();
                                //发动机号
                                String engineNum = fileCarInfoAddSubmit.getEngineNum();
                                //车牌号
                                String licenseNumber = fileCarInfoAddSubmit.getLicenseNumber();

                                //----------------------------------------------------------------------
                                //过滤为空的值内容
                                //过滤车辆品牌
                                if (TextUtils.isEmpty(carBranch)) {
                                    carBranch_hasNull = true;
                                }

                                //过滤车辆车系
                                if (TextUtils.isEmpty(carSeriesId)) {
                                    carSeriesId_hasNull = true;
                                }

                                //过滤车辆车型
                                if (TextUtils.isEmpty(carModelName)) {
                                    carModelName_hasNull = true;
                                }

                                //过滤车架号-因为是必填
                                if (TextUtils.isEmpty(vin)) {
                                    vin_hasNull = true;
                                }

                                //过滤车牌号，如果填写了，那么一定要校验车牌的正确性
                                if (TextUtils.isEmpty(licenseNumber)) {
                                    //车牌是空的就放过，不是必填；

                                } else {

                                    //说明车牌填写了，那么需要校验它的正确性； 说明有不空的；
                                    licenseNumber_hasNotNull = true;

                                    // TODO: 2023-11-09 10:04  要标记哪个是空的？
                                    //新建此存储
                                    HashMap<String, FileCarInfoAddSubmit> hashMapLicenseNumber = new HashMap<>();
                                    hashMapLicenseNumber.put(Parameterkey.key, fileCarInfoAddSubmit);
                                    fileCarInfoAddSubmit_out_licenseNumber.add(hashMapLicenseNumber);

                                }

                                //----------------------------------------------------------------------
                                //上传车辆的类型
                                fileCarInfoAddSubmitUpLoad.setVehicleType(vehicleType_upLoad);
                                //上传车辆品牌
                                fileCarInfoAddSubmitUpLoad.setCarBranch(carBranch);
                                //上传车辆车系
                                fileCarInfoAddSubmitUpLoad.setCarSeries(carSeriesId);
                                //上传车辆车型
                                fileCarInfoAddSubmitUpLoad.setCarModel(carModelName);
                                //上传车辆车架号
                                fileCarInfoAddSubmitUpLoad.setVin(vin);
                                //上传车辆发动机号
                                fileCarInfoAddSubmitUpLoad.setEngineNum(engineNum);
                                //上传车亮车牌号
                                fileCarInfoAddSubmitUpLoad.setLicenseNumber(licenseNumber);

                                //遍历添加条目；
                                fileCarInfoAddSubmit_out_list_upLoad.add(fileCarInfoAddSubmitUpLoad);

                            }
                        }
                    }


                    //弹窗提示
                    //验证车辆的品牌
                    if (carBranch_hasNull) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.select_lead_carbrand_toast), true);
                        mAlertView.show();
                        return;
                    }

                    //验证车辆车系  2024-2-19 17:01:15 新需求去掉
//                    if (carSeriesId_hasNull) {
//                        CommUtils.checkDialog(mAlertView);
//                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.select_lead_carbrandseries_toast), true);
//                        mAlertView.show();
//                        return;
//                    }

                    //验证车辆车型  2024-2-19 17:01:15 新需求去掉
//                    if (carModelName_hasNull) {
//                        CommUtils.checkDialog(mAlertView);
//                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.carname_upload), true);
//                        mAlertView.show();
//                        return;
//                    }

                    //验证车架号
                    if (vin_hasNull) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.car_number_car_frame), true);
                        mAlertView.show();
                        return;
                    }


                    //验证车辆--车牌号  2023-9-18 20:40:25修改需求： 车牌号不是必填
//                    if (TextUtils.isEmpty(licenseNumber_upLoad)) {
//                        CommUtils.checkDialog(mAlertView);
//                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.car_number_hint), true);
//                        mAlertView.show();
//                        return;
//                    }

                    //但是，如果车牌不是空，而是输入了车牌的部分编号，那么 需要校验一下输入车牌的正确性；
                    boolean isMustReturn = false;

                    if (licenseNumber_hasNotNull) {

                        for (HashMap<String, FileCarInfoAddSubmit> hashMap : fileCarInfoAddSubmit_out_licenseNumber) {

                            FileCarInfoAddSubmit fileCarInfoAddSubmit = hashMap.get(Parameterkey.key);

                            if (fileCarInfoAddSubmit != null) {

                                String getLicenseNumber = fileCarInfoAddSubmit.getLicenseNumber();

                                if (!TextUtils.isEmpty(getLicenseNumber)) {

                                    //输入完毕车牌号 立即校验输入车牌的正确性
                                    if (VehiclePlateNoUtil.getVehiclePlateNo(getLicenseNumber) == null) {

                                        //说明有车牌输入的不正确
                                        isMustReturn = true;

                                        CommUtils.checkDialog(mAlertView);
                                        String result = getString(R.string.please_input_carnumersure) + "【" + getLicenseNumber + "】";
                                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, result, true);
                                        mAlertView.show();

                                        break;
                                    }

                                }
                            }
                        }

                    }

                    //说明有车牌是不正确的，那么必须中断往下执行；
                    if (isMustReturn) {
                        return;
                    }

                    //--------------------------------------------------------------------------------------------------
                    //装载原始列表之中的单条合同信息；
                    ArrayList<ArchivesManageSingleUpLoad> archivesManageList_out_upLoad = new ArrayList<>();

                    //合同类型
                    boolean isAgreenType_hasNull = false;
                    //签约时间
                    boolean isAgreenTime_hasNull = false;
                    //签约人
                    boolean isAgreenContactPerson_hasNull = false;
                    //合同金额
                    boolean isAgreenAmountBigDecimal_hasNull = false;
                    //合同附件
                    boolean isFileSingleUpLoadFiles_hashMap = false;

                    // TODO: 2023-11-14 17:04 测试循环查看数据
                    //中间合同内容以及合同附件填充
                    for (AgreenMentFileAddSubmit agreenMentFileAddSubmit : mDataResources) {
//                    for (AgreenMentFileAddSubmit agreenMentFileAddSubmit : agreenMentFileAdapter.getData()) {

                        if (agreenMentFileAddSubmit != null) {

                            ArchivesManageSingleUpLoad archivesManageSingleUpLoadTemp = new ArchivesManageSingleUpLoad();
                            //合同类型
                            archivesManageSingleUpLoadTemp.setArchiveTypeId(agreenMentFileAddSubmit.getAgreenType());

                            //如果合同类型是空的，那么，记录外侧判断值；
                            if (TextUtils.isEmpty(agreenMentFileAddSubmit.getAgreenType())) {
                                //说明有空的
                                isAgreenType_hasNull = true;
                            }

                            //合同编号:备注 仅仅只能为空值；特别注意-暂时一直填空；
                            archivesManageSingleUpLoadTemp.setArchiveNo("");
                            //签约时间
                            archivesManageSingleUpLoadTemp.setSigningDate(agreenMentFileAddSubmit.getAgreenTime());
                            //如果合同签约时间是空的，那么，记录外侧判断值；
                            if (TextUtils.isEmpty(agreenMentFileAddSubmit.getAgreenTime())) {
                                //说明有空的
                                isAgreenTime_hasNull = true;
                            }

                            //购车人--签约人:
                            archivesManageSingleUpLoadTemp.setPartyA(agreenMentFileAddSubmit.getAgreenContactPerson());
                            //过滤 签约人
                            if (TextUtils.isEmpty(agreenMentFileAddSubmit.getAgreenContactPerson())) {
                                //说明有空的
                                isAgreenContactPerson_hasNull = true;
                            }

                            //合同金额 小数格式
                            archivesManageSingleUpLoadTemp.setAmount(agreenMentFileAddSubmit.getAgreenAmountBigDecimal());
                            //合同金额 字符串格式
                            archivesManageSingleUpLoadTemp.setAmountString(agreenMentFileAddSubmit.getAgreenAmountBigDecimalString());

                            //过滤 合同金额
                            if (TextUtils.isEmpty(agreenMentFileAddSubmit.getAgreenAmountBigDecimalString())) {
                                //说明有空的
                                isAgreenAmountBigDecimal_hasNull = true;
                            }

                            //车辆品牌传递空的
                            archivesManageSingleUpLoadTemp.setCarBrand("");
                            //车辆品牌型号传递空的
                            archivesManageSingleUpLoadTemp.setBrandModel("");

                            //填充合同的附件：合同附件的路径 类似："null/20230818/2023081811552872678725.jpg",
                            ArrayList<ArchivesManageFileVo> archivesManageFileVoList_UpLoad = new ArrayList<>();

                            if (agreenMentFileAddSubmit.getFileSingleUpLoadFiles_hashMap() != null && !agreenMentFileAddSubmit.getFileSingleUpLoadFiles_hashMap().isEmpty()) {

                                for (HashMap<String, Object> hashMap : agreenMentFileAddSubmit.getFileSingleUpLoadFiles_hashMap()) {

//                                {
//                                        "file_path_local": "/storage/emulated/0/Huawei/MagazineUnlock/magazine-unlock-05-2.3.2023080301-70A4699DCA5850C1506617697B8D9C6E.jpg",
//                                        "file_name": "magazine-unlock-05-2.3.2023080301-70A4699DCA5850C1506617697B8D9C6E.jpg",
//                                        "file_path_server": "null/20230818/2023081811552872678725.jpg",
//                                        "file_url_server": "http://222.222.17.184:8990/resource/null/20230818/2023081811552872678725.jpg",
//                                        "file_upload": {
//                                        "filePath": "null/20230818/2023081811552872678725.jpg"
//                                       }
//                                }

                                    ArchivesManageFileVo archivesManageFileVo = new ArchivesManageFileVo();

                                    if (hashMap != null) {
                                        String filePath = (String) hashMap.get(Parameterkey.file_path_server);
                                        archivesManageFileVo.setFilePath(filePath);
                                    }

                                    archivesManageFileVoList_UpLoad.add(archivesManageFileVo);
                                }

                                //直接填充列表
                                archivesManageSingleUpLoadTemp.setArchivesManageFileVoList(archivesManageFileVoList_UpLoad);

                                //填充上传的；
                                archivesManageList_out_upLoad.add(archivesManageSingleUpLoadTemp);

                            } else {

                                //说明没有合同的图片附件，那么需要给拦截赋值
                                isFileSingleUpLoadFiles_hashMap = true;

                            }
                        }
                    }

                    // TODO: 2023-11-14 16:11 测试提交的合同内容
                    method_test_agreenMent_upLoad(archivesManageList_out_upLoad);

                    //------------------------------------------------------------------------------------------------------------------
                    //底部档案的总的附件
                    ArrayList<InformationAccessoryUpLoad> informationAccessoryList_UpLoad = new ArrayList<InformationAccessoryUpLoad>();

                    if (fileSingleUpLoadFiles_attachment_address_hashMap_dynamics != null && !fileSingleUpLoadFiles_attachment_address_hashMap_dynamics.isEmpty()) {

                        for (HashMap<String, Object> hashMapItem : fileSingleUpLoadFiles_attachment_address_hashMap_dynamics) {

                            //注释勿删：2023-11-6 10:54:03
//                            {
//                                    "code":"20000",
//                                    "data":{
//                                        "largeUrlSuffix":"",
//                                        "smallUrlSuffix":"",
//                                        "url":"http://222.222.17.184:8990/resource/null/20230818/2023081810312051410204.jpg",
//                                        "urlPrefix":"http://222.222.17.184:8990/resource/",
//                                        "urlSuffix":"null/20230818/2023081810312051410204.jpg"
//                            },
//                                  "message":"success"
//                            }
//                            {
//                                   "file_path_local": "/storage/emulated/0/Huawei/MagazineUnlock/magazine-unlock-03-2.3.2023080309-33C2E77690711BF6E81AD3991BB41316.jpg",
//                                    "file_name": "magazine-unlock-03-2.3.2023080309-33C2E77690711BF6E81AD3991BB41316.jpg",
//                                    "file_path_server": "null/20230818/2023081816085441691303.jpg",
//                                    "file_url_server": "http://222.222.17.184:8990/resource/null/20230818/2023081816085441691303.jpg",
//                                    "file_upload": {
//                                    "filePath": "null/20230818/2023081816085441691303.jpg"
//                              }
//                            }

                            InformationAccessoryUpLoad informationAccessory_upLoad = new InformationAccessoryUpLoad();

                            if (hashMapItem != null) {

                                //完整的携带http的路径
                                // "url":"http://222.222.17.184:8990/resource/null/20230818/2023081810312051410204.jpg",
                                String fileFullPath = (String) hashMapItem.get(Parameterkey.file_url_server);
                                //指定为"urlSuffix":"null/20230818/2023081810312051410204.jpg"
                                String filePath = (String) hashMapItem.get(Parameterkey.file_path_server);
                                //图片的附件动态上传类型：2024-2-23 10:18:28
                                int fileType = (int) hashMapItem.get(Parameterkey.file_file_type);
                                //图片附件的动态上传
                                String fileTypeName = (String) hashMapItem.get(Parameterkey.file_file_type_name);

                                informationAccessory_upLoad.setFileType(fileType);//2024-2-23 10:28:27新增 附件上传的附件类型。
                                informationAccessory_upLoad.setFileTypeName(fileTypeName);//2024-2-23 11:09:39添加附件上传的名称，手机端传递过去，后台可以不用
                                informationAccessory_upLoad.setFilePath(filePath);
                                informationAccessory_upLoad.setFileName(fileFullPath);
                                informationAccessory_upLoad.setFileSize("");

                            }

                            informationAccessoryList_UpLoad.add(informationAccessory_upLoad);

                            //直接遍历上传的信息是
                            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "fileType类型是->" + hashMapItem.get(Parameterkey.file_file_type_name), informationAccessory_upLoad);

                        }

                    }

                    //------------------------------------------------------------------------------------------------------------------------------
                    //合同类型
//                    boolean isAgreenType_hasNull = false;
                    //签约时间
//                    boolean isAgreenTime_hasNull = false;
                    //签约人
//                    boolean isAgreenContactPerson_hasNull = false;
                    //合同金额
//                    boolean isAgreenAmountBigDecimal_hasNull = false;

                    //测试，判断列表内容
                    //判断列表的合同类型
                    if (isAgreenType_hasNull) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.check_isagreentype_hasnull), true);
                        mAlertView.show();
                        return;
                    }

                    //判断列表的签约时间
                    if (isAgreenTime_hasNull) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.check_isagreentime_hasnull), true);
                        mAlertView.show();
                        return;
                    }

                    //判断签约人：2024-2-19 17:00:20改为：销售顾问
                    if (isAgreenContactPerson_hasNull) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.check_isagreencontactperson_hasnull), true);
                        mAlertView.show();
                        return;
                    }

                    //判断合同金额  2024-2-20 11:26:21的现场测试需求是：合同金额不是必填项
//                    if (isAgreenAmountBigDecimal_hasNull) {
//                        CommUtils.checkDialog(mAlertView);
//                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.check_isagreenamountbigdecimal_hasnull), true);
//                        mAlertView.show();
//                        return;
//                    }

                    //判断合同附件是否为空的；
                    if (isFileSingleUpLoadFiles_hashMap) {
                        CommUtils.checkDialog(mAlertView);
                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.check_isfilesingleuploadfiles_hashmap), true);
                        mAlertView.show();
                        return;
                    }

                    //------------------------------------------------------------------------------------------------------------------------------
                    //发动机号暂时不验证

                    //如果档案附件是空，也给提示-因为必传 2024-2-23 09:16:38因为底部有动态配置必填项，那么这块不要了
//                    if (informationAccessoryList_UpLoad != null && informationAccessoryList_UpLoad.isEmpty()) {
//                        CommUtils.checkDialog(mAlertView);
//                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.please_archive_choose), true);
//                        mAlertView.show();
//                        return;
//                    }

                    boolean isArchiveFileHasNotUpLoadReturn = false;

                    //找出哪些是必填的，
                    if (mDataResources_archiveFile != null && !mDataResources_archiveFile.isEmpty()) {

                        Iterator<ArchiveFileType> iteratorArchiveFileType = mDataResources_archiveFile.iterator();

                        if (iteratorArchiveFileType != null) {

                            while (iteratorArchiveFileType.hasNext()) {

                                ArchiveFileType itemCurrent = iteratorArchiveFileType.next();

                                if (itemCurrent != null) {

                                    if (itemCurrent.isRequired()) {//如果是必填项

                                        //那么判断内部列表文件是否上传。
//                                      ArrayList<HashMap<String, Object>> fileSingleUpLoadFiles_hashMap_currentItem = new ArrayList<>();
                                        if (itemCurrent.getFileSingleUpLoadFiles_hashMap() != null && !itemCurrent.getFileSingleUpLoadFiles_hashMap().isEmpty()) {
                                            //fileSingleUpLoadFiles_hashMap_currentItem.addAll();
                                            //如果必填项的 图片九宫格有内容，那么放过，

                                        } else {

                                            isArchiveFileHasNotUpLoadReturn = true;

                                            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "遍历到[必填项]的附件没有上传-是->", itemCurrent);

                                            //如果发现必填项的图片九宫格，是没有内容的，那么需要拦截，并且给提示,并且一旦发现一个就立即给拦截，停止传输数据.
                                            String titleName = itemCurrent.getFileTypeName();
                                            String titleResult = getResources().getString(R.string.please_archive_choose_half) + titleName;

//                                          if (informationAccessoryList_UpLoad != null && informationAccessoryList_UpLoad.isEmpty()) {

                                            CommUtils.checkDialog(mAlertView);
                                            mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, titleResult, true);
                                            mAlertView.show();

                                            break;

//                                            }

                                        }


                                    } else {
//                                        LogUtils.json(ConstantSign.LOGCAT_NOMAL + "遍历到[不是必填]的附件合同是", itemCurrent);
                                    }

                                }
                            }
                        }

                    }

                    //------------------------------------------------------------------------------------------------------------------------------
                    //如果发现有没有上传必传的附件的，必须拦截
                    if (isArchiveFileHasNotUpLoadReturn) {
                        return;
                    }

                    //------------------------------------------------------------------------------------------------------------------------------

                    CommUtils.checkDialog(mAlertView);
                    mAlertView = new AlertView(StringUtils.getString(R.string.clearaddorsubmitsuretitletips), //提示
                            StringUtils.getString(R.string.clearaddorsubmitsuremessage),//提示内容
                            StringUtils.getString(R.string.clearcachecancel), //取消
                            new String[]{StringUtils.getString(R.string.clearaddorsubmitsure)},//确定
                            null, mActivityInstance, AlertView.Style.Alert, new OnItemClickListener() {//
                        @Override
                        public void onItemClick(Object o, int position) {

                            if (position != AlertView.CANCELPOSITION) {

                                //主要是2个列表大块是临时处理的，其余都在外侧
                                method_remedialItems_addSubmit_upLoad(archivesManageList_out_upLoad, informationAccessoryList_UpLoad, fileCarInfoAddSubmit_out_list_upLoad);

                            }
                        }
                    });

                    mAlertView.setCancelable(true);
                    mAlertView.show();

                    //--------------------------------------------------------------------------------------------------


                }
            });

        }


        //        initConfig();

    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();

        ImmersionBar.with(this)//
                .titleBar(R.id.toolbarygxskout)
                .fitsSystemWindows(true)//解决状态栏和布局重叠问题，任选其一，默认为false，当为true时一定要指定statusBarColor()，不然状态栏为透明色，还有一些重载方法
                //.statusBarColor(R.color.colorPrimary)//
                //.navigationBarColor(R.color.colorPrimary)//
                //.keyboardEnable(true)
                .init();

    }

    @Override
    protected int getContentViewId() {
        return R.layout.activity_archive_file_add_submit;
    }

    @Override
    protected void initToolBar(ToolbarHelper toolbarHelper) {

        toolbarHelper.setTitle(getString(R.string.title_file_add_submit));
        toolbarHelper.setVersionName(true, AppUtils.getAppVersionName());
        toolbarHelper.setLayoutClose(false, "", null);
        toolbarHelper.setLayoutLeft(true, R.drawable.backicon, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //搜索客户信息，优先关闭软键盘
                KeyboardUtils.hideSoftInput(mActivityInstance);
//                methodBack();
                method_check_back();
            }
        });

        //添加潜在客户的按钮
        toolbarHelper.setLayoutRight(false, 0, "", null);

//        toolbarHelper.setLayoutRight(true, 0, getString(R.string.title_right_history), new ClickUtils.OnDebouncingClickListener() {
//            @Override
//            public void onDebouncingClick(View v) {
//                //快速双加的限制，
//                Bundle extra_bundle = new Bundle();
////                ActivityUtils.startActivity(extra_bundle, LeadAddSubmitActivity.class);
//            }
//        });

    }

    @Override
    protected void onClickNodata(View v) {
        //retain
    }

    @Override
    protected void initViews() {

        //初始化性别
        if (mDataResources_genderType != null) {
            mDataResources_genderType.addAll(ViewUitls.getGenderTypes());
        }

        //默认添加第一个合同的信息；因为可能有多个合同
        //recyclerViewAgreenMent.setLayoutManager(new MyLinearLayoutManager(ArchiveFileAddSubmitActivity.this));
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);

        // 垂直方向
        layoutManager.setOrientation(RecyclerView.VERTICAL);
        recyclerViewAgreenMent.setLayoutManager(layoutManager);
        //添加适配器
        agreenMentFileAdapter = new AgreenMentFileAdapter(R.layout.agreen_ment_adapter, mDataResources);
        //设置监听器
        agreenMentFileAdapter.setMyArchiveFileAddSubmitListener(myArchiveFileAddSubmitListener);
        //设置九宫格图片监听器
        agreenMentFileAdapter.setMyMaskProgressLayoutListener(myMaskProgressLayoutListener);

        //添加header
        agreenMentFileAdapter.removeAllHeaderView();
        agreenMentFileAdapter.removeAllFooterView();

        //客户信息 第一布局
        agreenMentFileAdapter.addHeaderView(getHeaderView_customerInfo(recyclerViewAgreenMent));
        //车辆信息第二布局
        agreenMentFileAdapter.addHeaderView(getHeaderView_carInfo(recyclerViewAgreenMent));

        //底部的档案附件布局
        agreenMentFileAdapter.addFooterView(getFooterViewAddMoreArchiveFiles(recyclerViewAgreenMent));

        recyclerViewAgreenMent.setAdapter(agreenMentFileAdapter);
        agreenMentFileAdapter.notifyDataSetChanged();

        if (agreenMentFileAdapter != null) {
            //内部包含：notifyDataSetChanged
            agreenMentFileAdapter.addData(method_add_theFirst_archiveFile());
//            agreenMentFileAdapter.getData().(method_add_theFirst_archiveFile());
        }

        //自动滚动到底部,可以实现展开
        //recyclerViewAgreenMent.scrollToPosition(0+agreenMentFileAdapter.getHeaderLayoutCount());

        //关于车牌的软键盘的问题
//        keyboardUtil = new CarKeyboardUtil(this, editViewCarCard);

        //最开始的时候设置提交按钮不可用
//        editViewCarCard.setOnTouchListener(new View.OnTouchListener() {
//
//            @Override
//            public boolean onTouch(View view, MotionEvent event) {
//
//                switch (view.getId()) {
//
//                    //添加车牌的findviewid
//                    case R.id.editviewcarcard:
//
//                        //2019年11月06日自己做软键盘关闭
//                        KeyboardUtils.hideSoftInput(ArchiveFileAddSubmitActivity.this);
//
////                        if (!keyboardUtil.isShow()) {
////                            keyboardUtil.showKeyboard();
////                        }
//
//                        break;
//
//                    default:
//
////                        if (keyboardUtil.isShow()) {
////                            keyboardUtil.hideKeyboard();
////                        }
//
//                        break;
//
//                }
//                return false;
//            }
//        });

//        //输入监听
//        editViewCarCard.addTextChangedListener(new TextWatcher() {
//
//            @Override
//            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//                //暂时不处理
//            }
//
//            @Override
//            public void onTextChanged(CharSequence s, int start, int before, int count) {
//
//                String text = s.toString();
//
//                //checkViewState(text);
//
//                if (s.length() == 8) {
//
//                    //layoutPlateNumber.setBackgroundResource(R.drawable.btn_round_blue);
//                    imgIconInmMiddle.setVisibility(View.VISIBLE);
//
//                } else {
//
//                    //layoutPlateNumber.setBackgroundResource(R.drawable.btn_round_green);
//                    imgIconInmMiddle.setVisibility(View.GONE);
//
//                }
//
//                if (text.contains("港") || text.contains("澳") || text.contains("学")) {
//
//                    editViewCarCard.setFilters(new InputFilter[]{new InputFilter.LengthFilter(7)});
//
//                } else {
//
//                    editViewCarCard.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8)});
//
//                }
//
//            }
//
//            @Override
//            public void afterTextChanged(Editable s) {
//
//                //暂时不填充
//                //如果是一个正确车牌，那么，就校验这个车牌是否在黑名单内
//
//            }
//        });

        //------------------------------------------------------------------------------------------
//        //输入完毕校验车牌的正确性，如果是这个正确的输入完毕就校验一次【车牌是否是在黑名单】
//        mCompositeDisposable.add(RxTextView.afterTextChangeEvents(editViewCarCard)
//                .debounce(ConstantApi.TIME_DELAY500, TimeUnit.MILLISECONDS)
//                .skip(ConstantApi.SKIP_CAR_NUMBER)//过滤掉前4个都行 【京Q58A77】
//                .observeOn(AndroidSchedulers.mainThread())//
//                .subscribeOn(AndroidSchedulers.mainThread())//
//                .subscribe(new Consumer<TextViewAfterTextChangeEvent>() {
//                    @Override
//                    public void accept(TextViewAfterTextChangeEvent textViewAfterTextChangeEvent) throws Throwable {
//
//                        try {
//
//                            //do
//                            if (textViewAfterTextChangeEvent != null) {
//
//                                String editResult = textViewAfterTextChangeEvent.getView().getText().toString();
//
//                                //LogUtils.d(ConstantApi.LOGCAT_NOMAL + "输入完毕的数据是-->" + editResult);
//
//                                //如果小区id不是空，并且车牌也不是空；  && !TextUtils.isEmpty(upload_CommunityId)
//                                if (!TextUtils.isEmpty(editResult)) {
//
//                                    //校验【不是空】说明输入的是正确的车牌，那么校验【该完整车牌是否在黑名单之中】
//                                    //校验如果是空，说明输入的是错误的车牌
//                                    if (VehiclePlateNoUtil.getVehiclePlateNo(editViewCarCard.getText().toString().trim()) == null) {
//
//                                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "手机校验是正确的车牌");
//
//                                        String result = getString(R.string.please_input_carnumersure);
//                                        PopTip.show(result).iconWarning();
//
////                                        if (!TextUtils.isEmpty(upload_CommunityId)) {//调用接口 校验是不是【在该小区的黑名单列表内】
////                                            method_checkVisitorCarIsSure_afterTextChange();
////                                        } else {
//////                                            LogUtils.d(ConstantApi.LOGCAT_NOMAL + "校验发现小区没有选择，提示选择小区，然后再次校验-");
////                                        }
//
//                                    }
//
//                                }
//                            }
//
//                        } catch (Exception e) {
//                            //catch
//                            if (e != null) {
//                                //上传操作日志
//
//                            }
//                        }
//                    }
//                }));

    }

    //添加第一条车辆信息，
    private FileCarInfoAddSubmit method_add_theFirst_fileCar() {

        FileCarInfoAddSubmit fileCarInfoAddSubmit = new FileCarInfoAddSubmit();
        fileCarInfoAddSubmit.setId(Parameterkey.AGREEN_MENT_FILE_ID);
        fileCarInfoAddSubmit.setIdentifierNumber(identifierNumber_carInfo);

        if (carBrandLargeCategory_defaultOne != null) {

            //初始化品牌的id
            fileCarInfoAddSubmit.setCarBranchId(carBrandLargeCategory_defaultOne.getCarBrandId());
            //初始化品牌的名称：本来默认是空值，但是2024年2月19日17:44:21现场测试要求：默认填充车辆品牌的第一条数据。
            fileCarInfoAddSubmit.setCarBranchName(carBrandLargeCategory_defaultOne.getCarBrandName());

//            LogUtils.d(ConstantSign.LOGCAT_NOMAL+"--fileCarInfoAddSubmit-->"+fileCarInfoAddSubmit.getCarBranchId());
//            LogUtils.d(ConstantSign.LOGCAT_NOMAL+"--fileCarInfoAddSubmit-->"+fileCarInfoAddSubmit.getCarBranchName());

        } else {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--carBrandLargeCategory_defaultOne-->是空的");

            fileCarInfoAddSubmit.setCarBranchId("");
            fileCarInfoAddSubmit.setCarBranchName("");

        }

        //初始化车系id
        fileCarInfoAddSubmit.setCarSeriesId("");
        //初始化车系的名称
        fileCarInfoAddSubmit.setCarSeriesName("");

        //初始化车型
        fileCarInfoAddSubmit.setCarModelName("");
        fileCarInfoAddSubmit.setVin("");
        fileCarInfoAddSubmit.setLicenseNumber("");
        fileCarInfoAddSubmit.setEngineNum("");

        return fileCarInfoAddSubmit;
    }

    private AgreenMentFileAddSubmit method_add_theFirst_archiveFile() {

        AgreenMentFileAddSubmit agreenMentFileAddSubmit = new AgreenMentFileAddSubmit();
        agreenMentFileAddSubmit.setId(Parameterkey.AGREEN_MENT_FILE_ID);
        agreenMentFileAddSubmit.setIdentifierNumber(identifierNumber);
        //合同类型
        agreenMentFileAddSubmit.setAgreenType("");//默认是空值
        //合同类型的文字描述
        agreenMentFileAddSubmit.setAgreenTime("");//默认是空值
        agreenMentFileAddSubmit.setAgreenContactPerson("");//签约人  默认是空值
        agreenMentFileAddSubmit.setAgreenTime("");//签约时间，默认是空值

        agreenMentFileAddSubmit.setAgreenAmountBigDecimal(CommUtils.formatComma2BigDecimal(ConstantApi.BIGDECIMAL_ZERO));
        agreenMentFileAddSubmit.setAgreenAmountBigDecimalString("");//合同金额的字符格式
        //图片形式
        agreenMentFileAddSubmit.getFileSingleUpLoadFiles_hashMap().clear();

        agreenMentFileAddSubmit.setEvaluateWadeInfo(null);
        //提供一个新的？
//        agreenMentFileAddSubmit.setMaskProgressLayout(new MaskProgressLayout(ArchiveFileAddSubmitActivity.this));

        //图片的装载控件:新添加的默认是个空图片集合
        if (agreenMentFileAddSubmit.getMaskProgressLayout() != null) {
            List<String> listTemp = new ArrayList<>();
            agreenMentFileAddSubmit.getMaskProgressLayout().setImageUrls(listTemp);
        }

        return agreenMentFileAddSubmit;

    }

    //是客户信息 的第一个头部填充；
    private View getHeaderView_customerInfo(RecyclerView _recyclerViewWork) {

        View workHeader_customerInfo;

        if ((_recyclerViewWork != null) && (_recyclerViewWork.getParent() != null)) {
            workHeader_customerInfo = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(//
                    R.layout.fileaddtop, //archive_file_addsubmit_header
                    (ViewGroup) _recyclerViewWork.getParent(),//
                    false);//
        } else {
            workHeader_customerInfo = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(R.layout.fileaddtop, null);
        }

        //findviews
        ConstraintLayout constraintLayoutTopCustomerInfo = (ConstraintLayout) workHeader_customerInfo.findViewById(R.id.constraintlayouttopcustomerinfo);
        //包裹客户信的外侧布局
        LinearLayout linearLayoutCustomerInfoWrap = (LinearLayout) workHeader_customerInfo.findViewById(R.id.linearlayoutcustomerinfowrap);

        //向右边的箭头
        ImageView imageViewArrowInCustomerInfoRight = (ImageView) workHeader_customerInfo.findViewById(R.id.imageviewarrowincustomerinforight);
        //向下的箭头
        ImageView imageViewArrowInCustomerInfodDown = (ImageView) workHeader_customerInfo.findViewById(R.id.imageviewarrowincustomerinfodown);

        //客户姓名
        editView_customer_name = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_file_name);

        //选择客户信息，2024-2-21 从潜客列表之中选择
        RoundTextView roundTextViewChooseRight = (RoundTextView) workHeader_customerInfo.findViewById(R.id.roundtextviewchooseright);

        //客户性别外侧包裹，做点击
        LinearLayout layoutFilePersonSex = (LinearLayout) workHeader_customerInfo.findViewById(R.id.layoutfilepersonsex);
        //客户性别的文本填充
        textview_customer_sex = (TextView) workHeader_customerInfo.findViewById(R.id.textview_customer_sex);
        //年龄
        editView_customer_years = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_customer_years);
        //手机号
        editView_customer_phone = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_customer_phone);
        //微信号
        editView_customer_wechart = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_customer_wechart);
        //客户的邮箱
        editView_customer_email = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_customer_email);
        //客户的公司信息
        editView_customer_address = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_customer_address);
        //客户的地址
        editView_customer_company = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_customer_company);
        //职位信息 也即是工作信息
        editView_customer_job = (ClearEditTextTouch) workHeader_customerInfo.findViewById(R.id.editview_customer_job);

        //备注信息,暂时没有;
        //ClearEditText editView_customer_job =  (ClearEditText)workHeader.findViewById(R.id.editview_customer_job);

        //客户信息的顶部，点击展开和掩盖。
        if (constraintLayoutTopCustomerInfo != null) {
            constraintLayoutTopCustomerInfo.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    //软键盘
//                    if (keyboardUtil.isShow()) {
//                        keyboardUtil.hideKeyboard();
//                    }

                    if (linearLayoutCustomerInfoWrap.getVisibility() == View.VISIBLE) {

                        linearLayoutCustomerInfoWrap.setVisibility(View.GONE);
                        imageViewArrowInCustomerInfoRight.setVisibility(View.VISIBLE);
                        imageViewArrowInCustomerInfodDown.setVisibility(View.GONE);

                    } else if (linearLayoutCustomerInfoWrap.getVisibility() == View.GONE) {

                        linearLayoutCustomerInfoWrap.setVisibility(View.VISIBLE);
                        imageViewArrowInCustomerInfoRight.setVisibility(View.GONE);
                        imageViewArrowInCustomerInfodDown.setVisibility(View.VISIBLE);

                    }

                }
            });
        }

        //选择客户-是潜客的列表
        if (roundTextViewChooseRight != null) {
            roundTextViewChooseRight.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    Bundle extra_bundle = new Bundle();

                    //携带？
                    ActivityUtils.startActivity(extra_bundle, LeadsDataActivity.class);

                }
            });

        }

        //客户性别 外侧点击
        if (layoutFilePersonSex != null) {
            layoutFilePersonSex.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                @Override
                public void onDebouncingClick(View v) {

//                    if (keyboardUtil.isShow()) {
//                        keyboardUtil.hideKeyboard();
//                    }

                    //性别弹窗，做选择
                    //"gender": 1, //性别
                    KeyboardUtils.hideSoftInput(ArchiveFileAddSubmitActivity.this);

                    LeadsGenderSelectPopu leadsGenderSelectPopu = new LeadsGenderSelectPopu(ArchiveFileAddSubmitActivity.this,//
                            ExtraValue.MODIFY_LEAD_GENDER_SELECT_IN_ARCHIVE_FILE_ADD,//
                            mDataResources_genderType);

                    leadsGenderSelectPopu.setTitleName(getResources().getString(R.string.please_choose_person_sex));

                    //直接弹窗：
                    basePopupViewGender = new XPopup.Builder(ArchiveFileAddSubmitActivity.this)
                            .hasShadowBg(true)
                            //.moveUpToKeyboard(false) //如果不加这个，评论弹窗会移动到软键盘上面
                            .isViewMode(true)
                            //.autoDismiss(false)
                            //.isDestroyOnDismiss(true) //对于只使用一次的弹窗，推荐设置这个
                            .isThreeDrag(false) //是否开启三阶拖拽，如果设置enableDrag(false)则无效
                            //.dismissOnTouchOutside(true)
                            //.notDismissWhenTouchInView()
                            .moveUpToKeyboard(false)
                            .asCustom(leadsGenderSelectPopu)//
                            .show();

                }
            });
        }

        //监听性别变动
        mCompositeDisposable.add(RxBus.getInstance()//
                .toObserverable(RxBusGender.class)//
                .subscribeOn(AndroidSchedulers.mainThread())//
                .observeOn(AndroidSchedulers.mainThread())//
                .subscribe(new Consumer<RxBusGender>() {//
                    @Override
                    public void accept(RxBusGender rxBusGender) throws Exception {

                        int actionFlag = rxBusGender.getActionFlag();
                        LeadsGenderInfoBean leadsGenderInfoBean = rxBusGender.getLeadsGenderInfoBean();

                        if (actionFlag == ExtraValue.MODIFY_LEAD_GENDER_SELECT_IN_ARCHIVE_FILE_ADD) {//更改了店铺信息和重新存储id等

                            gender_upLoad = leadsGenderInfoBean.getTypeId();

//                            LogUtils.d("itchen---mCompositeDisposable---切换性别-->" + leadsGenderInfoBean);

                            if (textview_customer_sex != null) {
                                textview_customer_sex.setText(leadsGenderInfoBean.getName());
                            }

                        }
                    }
                }));

        //==========================================================================================================================
        return workHeader_customerInfo;

    }

    //添加第二个布局-是车辆的布局
    private View getHeaderView_carInfo(RecyclerView _recyclerViewWork) {

        View workHeaderCarInfoList;

        if ((_recyclerViewWork != null) && (_recyclerViewWork.getParent() != null)) {
            workHeaderCarInfoList = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(//
                    R.layout.fileaddmiddle_list, //archive_file_addsubmit_header
                    (ViewGroup) _recyclerViewWork.getParent(),//
                    false);//
        } else {
            workHeaderCarInfoList = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(R.layout.fileaddmiddle_list, null);
        }

        //顶部的布局-不让这里点击，让外侧的cardview点击
//      ConstraintLayout constraintLayoutTopInside = (ConstraintLayout) workHeaderCarInfoList.findViewById(R.id.constraintlayouttopinside);

        //外侧的cardView的点击
        CardView cardViewTopCarInfoOutside = (CardView) workHeaderCarInfoList.findViewById(R.id.cardviewtopcarinfooutside);

        //填充list内容--默认是隐藏的
        RecyclerView recyclerViewCars = (RecyclerView) workHeaderCarInfoList.findViewById(R.id.recyclerviewcarinfoaddsubmit);

        //填充适配器
        recyclerViewCars.setLayoutManager(new MyLinearLayoutManager(this));
        archiveFileCarInfoAddSubmitAdapter = new ArchiveFileCarInfoAddSubmitAdapter(R.layout.fileaddmiddle_carinfo,//
                mDataResourceCars, //
                ArchiveFileAddSubmitActivity.this,//
                myArchiveFileCarInfoAddListener);//

        recyclerViewCars.setAdapter(archiveFileCarInfoAddSubmitAdapter);
        archiveFileCarInfoAddSubmitAdapter.removeAllFooterView();
        archiveFileCarInfoAddSubmitAdapter.addFooterView(getFooterViewCarInfo(recyclerViewAgreenMent));
        archiveFileCarInfoAddSubmitAdapter.notifyDataSetChanged();

        //默认的要添加一条空的
        if (archiveFileCarInfoAddSubmitAdapter != null) {
            archiveFileCarInfoAddSubmitAdapter.addData(method_add_theFirst_fileCar());
        }

        if (cardViewTopCarInfoOutside != null) {
            cardViewTopCarInfoOutside.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    if (recyclerViewCars.getVisibility() == View.VISIBLE) {

                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "recyclerViewCars 即将 关闭");
                        recyclerViewCars.setVisibility(View.GONE);

                    } else if (recyclerViewCars.getVisibility() == View.GONE) {

                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "recyclerViewCars 即将 打开");
                        recyclerViewCars.setVisibility(View.VISIBLE);

                    }

                }
            });
        }

        return workHeaderCarInfoList;
    }

    //添加车辆信息的底部内容,仅仅只有一个添加车辆信息的大按钮；
    private View getFooterViewCarInfo(RecyclerView _recyclerViewWork) {

        View workFooter;

        if ((_recyclerViewWork != null) && (_recyclerViewWork.getParent() != null)) {
            workFooter = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(//
                    R.layout.archive_file_carinfo_footer, //
                    (ViewGroup) _recyclerViewWork.getParent(),//
                    false);//
        } else {
            workFooter = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(R.layout.archive_file_carinfo_footer, null);
        }

        ImageView imageViewAddSubmitCarInfo = (ImageView) workFooter.findViewById(R.id.imageviewaddsubmitcarinfo);

        //判断是否是填写完毕所有必填项
        if (imageViewAddSubmitCarInfo != null) {

            imageViewAddSubmitCarInfo.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {

                @Override
                public void onDebouncingClick(View v) {

                    identifierNumber = identifierNumber + 1;
                    //LogUtils.d(ConstantSign.LOGCAT_NOMAL + "新增的条目的序号是-->" + identifierNumber);
                    KeyboardUtils.hideSoftInput(mActivityInstance);
//                    if (keyboardUtil.isShow()) {
//                        keyboardUtil.hideKeyboard();
//                    }
                    //遍历列表，第一条没有添加完毕，不然添加第二条
                    int dataHasNull = 0;
                    //但是，如果车牌不是空，而是输入了车牌的部分编号，那么 需要校验一下输入车牌的正确性；
                    boolean isMustReturn_addOne = false;

                    Iterator<FileCarInfoAddSubmit> iterator = mDataResourceCars.iterator();

                    if (iterator != null) {

                        while (iterator.hasNext()) {

                            FileCarInfoAddSubmit fileCarInfoAddSubmit = iterator.next();
                            LogUtils.json(ConstantSign.LOGCAT_NOMAL, (fileCarInfoAddSubmit));

                            if (fileCarInfoAddSubmit != null) {

                                //车辆品牌-主要验证品牌id
                                String carBranch = fileCarInfoAddSubmit.getCarBranchId();
                                //车系 -主要验证车系的id
                                String carSeriesId = fileCarInfoAddSubmit.getCarSeriesId();
                                //车型是录入的
                                String carModelName = fileCarInfoAddSubmit.getCarModelName();
                                //车架号
                                String vin = fileCarInfoAddSubmit.getVin();

                                //---------------------------------------------------------------------------------------------------------------------------------------
                                //车牌号
                                String licenseNumber = fileCarInfoAddSubmit.getLicenseNumber();

                                //如果车牌号是空就放过，如果车牌号真的填写了，那么必须校验
                                if (!TextUtils.isEmpty(licenseNumber)) {

                                    //输入完毕车牌号 立即校验输入车牌的正确性
                                    if (VehiclePlateNoUtil.getVehiclePlateNo(licenseNumber) == null) {

                                        //说明有车牌输入的不正确
                                        isMustReturn_addOne = true;

                                        CommUtils.checkDialog(mAlertView);
                                        String result = getString(R.string.please_input_carnumersure) + "【" + licenseNumber + "】";
                                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, result, true);
                                        mAlertView.show();

                                        break;
                                    }

                                }

                                //---------------------------------------------------------------------------------------------------------------------------------------
                                //该条目上传的图片
//                                ArrayList<HashMap<String, Object>> fileSingleUpLoadFiles_upLoad = fileCarInfoAddSubmit.getFileSingleUpLoadFiles_hashMap();

                                if (TextUtils.isEmpty(carBranch)//
                                        || TextUtils.isEmpty(carSeriesId)//
                                        || TextUtils.isEmpty(carModelName)//
                                        || TextUtils.isEmpty(vin)) {//|| TextUtils.isEmpty(licenseNumber)车牌号不是必填；
                                    dataHasNull = 1;
                                }

                            }
                        }
                    }

                    //请填写完整再添加
                    if (dataHasNull == 1) {
                        //ToastUtils.showShort(R.string.toastaddtips);
                        String tips = getString(R.string.toastaddtips_archivefile);
                        PopTip.show(tips).iconWarning();
                        return;
                    }

                    //说明有车牌是不正确的，那么必须中断往下执行；
                    if (isMustReturn_addOne) {
                        return;
                    }

                    // TODO: 2023-11-09 10:44 这里还差车牌的校验
                    FileCarInfoAddSubmit fileCarInfoAddSubmit = method_add_theFirst_fileCar();

                    if (archiveFileCarInfoAddSubmitAdapter != null) {
                        archiveFileCarInfoAddSubmitAdapter.addData(fileCarInfoAddSubmit);
                    }

                }
            });
        }

        return workFooter;

    }

    private View getFooterViewAddMoreArchiveFiles(RecyclerView _recyclerViewWork) {

        View agreementFooter;
        if ((_recyclerViewWork != null) && (_recyclerViewWork.getParent() != null)) {
            agreementFooter = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(//
                    R.layout.archive_file_addsubmit_footer, //
                    (ViewGroup) _recyclerViewWork.getParent(),//
                    false);//
        } else {
            agreementFooter = LayoutInflater.from(ArchiveFileAddSubmitActivity.this).inflate(R.layout.archive_file_addsubmit_footer, null);
        }

        //添加合同的 的【加号大图片】
        ImageView imageViewAddSubmitInArchiveFile = (ImageView) agreementFooter.findViewById(R.id.imageviewaddsubmitinarchivefile);

        //--------------------------------------------------------------------------------------------------------------------------------------------
        //上传组件,添加档案的
//        mplimageListInArchiveCheckFooterView = (MaskProgressLayout) agreementFooter.findViewById(R.id.mplimagelistinarchivefilebottom);
//        TextView textViewInArchiveBottomHelp = (TextView) agreementFooter.findViewById(R.id.textviewinarchivebottomhelp);
//        CommUtils.methodHelpView4(textViewInArchiveBottomHelp);
//        //添加图片信息. mplimageListInArchiveCheck 它用自己的图片逻辑
//        mplimageListInArchiveCheckFooterView.setMaskProgressLayoutListener(new MyFooterMaskProgressLayoutListener());
        //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        RecyclerView recyclerViewFileType = (RecyclerView) agreementFooter.findViewById(R.id.recyclerviewinarchivetype);
        recyclerViewFileType.setLayoutManager(new MyLinearLayoutManager(ArchiveFileAddSubmitActivity.this));

        //设置事件监听
        footerModifyAddSubmitArchiveFileTypeAdapter = new FooterModifyAddSubmitArchiveFileTypeAdapter(R.layout.filetype_adapter, mDataResources_archiveFile);
//        footerModifyAddSubmitArchiveFileTypeAdapter.setMyFooterMaskProgressLayoutListener(myFooterMaskProgressLayoutListener);

        recyclerViewFileType.setAdapter(footerModifyAddSubmitArchiveFileTypeAdapter);
        footerModifyAddSubmitArchiveFileTypeAdapter.notifyDataSetChanged();

        //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //判断是否是填写完毕所有必填项
        if (imageViewAddSubmitInArchiveFile != null) {
            imageViewAddSubmitInArchiveFile.setOnClickListener(new ClickUtils.OnDebouncingClickListener() {
                @Override
                public void onDebouncingClick(View v) {

                    identifierNumber = identifierNumber + 1;
                    //LogUtils.d(ConstantSign.LOGCAT_NOMAL + "新增的条目的序号是-->" + identifierNumber);
                    KeyboardUtils.hideSoftInput(mActivityInstance);
//                    if (keyboardUtil.isShow()) {
//                        keyboardUtil.hideKeyboard();
//                    }
                    //遍历列表，第一条没有添加完毕，不然添加第二条
                    int dataHasNull = 0;
                    Iterator<AgreenMentFileAddSubmit> iterator = mDataResources.iterator();
                    if (iterator != null) {
                        while (iterator.hasNext()) {

                            AgreenMentFileAddSubmit agreenMentFileAddSubmit = iterator.next();
                            //LogUtils.json(ConstantSign.LOGCAT_NOMAL + "AgreenMentFileAddSubmit", agreenMentFileAddSubmit);

                            if (agreenMentFileAddSubmit != null) {

                                //合同类型
                                String agreenType = agreenMentFileAddSubmit.getAgreenType();
                                //签约时间
                                String agreenTime = agreenMentFileAddSubmit.getAgreenTime();
                                //签约人
                                String agreenContactPerson = agreenMentFileAddSubmit.getAgreenContactPerson();
                                //合同金额
                                String agreenAmountString = agreenMentFileAddSubmit.getAgreenAmountBigDecimalString();
                                //该条目上传的图片
                                ArrayList<HashMap<String, Object>> fileSingleUpLoadFiles_upLoad = agreenMentFileAddSubmit.getFileSingleUpLoadFiles_hashMap();

                                if (TextUtils.isEmpty(agreenType)//
                                        || TextUtils.isEmpty(agreenTime)//
                                        || TextUtils.isEmpty(agreenContactPerson)//
                                        || TextUtils.isEmpty(agreenAmountString)//
                                        || fileSingleUpLoadFiles_upLoad.size() == 0) {//
                                    dataHasNull = 1;
                                }

                            }
                        }
                    }

                    //请填写完整再添加
                    if (dataHasNull == 1) {
                        //ToastUtils.showShort(R.string.toastaddtips);
                        String tips = getString(R.string.toastaddtips_archivefile);
                        PopTip.show(tips).iconWarning();
                        return;
                    }

                    //添加完毕之后计算计算总笔数，一定要是前边的【每一项填写完毕】再计算
                    AgreenMentFileAddSubmit agreenMentFileAddSubmit = method_add_theFirst_archiveFile();

                    if (agreenMentFileAdapter != null) {
                        agreenMentFileAdapter.addData(agreenMentFileAddSubmit);
                    }

                }
            });
        }

        return agreementFooter;

    }


    @Override
    protected void gainDatas() {

        if (NetworkUtils.isConnected()) {

            //获取 车辆品牌+车系
            //获取车辆的品牌信息
            gainCarBrandLargeCategory(null);

            //获取合同类型
            gainContractType(null);

        } else {
            //retain
        }

    }

    //该页面的监听器  勾选合同和签约时间修改;
    private MyArchiveFileAddSubmitListener myArchiveFileAddSubmitListener = new MyArchiveFileAddSubmitListener() {

        @Override
        public void chooseAgreementType(int _identifierNumber, EvaluateWadeInfo _evaluateWadeInfo, AgreenMentFileAddSubmit _agreenMentFileAddSubmit) {

            //直接弹窗，获取合同的类型
            KeyboardUtils.hideSoftInput(mActivityInstance);

            if (_agreenMentFileAddSubmit != null) {

                EvaluateWadePopu evaluateWadePopu = new EvaluateWadePopu(ArchiveFileAddSubmitActivity.this,//
                        ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TYPE_SELECT,//合同类型
                        mDataResources_archiveTypeList_forPopu);

                evaluateWadePopu.setTitleName(getResources().getString(R.string.please_choose_agreen_type));

                //做数据回显的时候用到
                evaluateWadePopu.setAgreenMentFileAddSubmit(_agreenMentFileAddSubmit);

                basePopupView_agreeMentType = new XPopup.Builder(ArchiveFileAddSubmitActivity.this)
                        .hasShadowBg(true)
                        .isViewMode(true)
                        .asCustom(evaluateWadePopu)//
                        .show();

            } else {

            }

        }

        @Override
        public void chooseAgreementTime(int _identifierNumber, AgreenMentFileAddSubmit _agreenMentFileAddSubmit) {
            KeyboardUtils.hideSoftInput(mActivityInstance);

            if (_agreenMentFileAddSubmit != null) {

                CalendarViewCustomPopup calendarViewCustomPopup = new CalendarViewCustomPopup(ExtraValue.MODIFY_ARCHIVEFILE_AGREEMENT_TIME_SELECT,
                        _agreenMentFileAddSubmit.getIdentifierNumber(),
                        ArchiveFileAddSubmitActivity.this, false);
                //设置这个合同，为了方便回显时间携带；
                calendarViewCustomPopup.setAgreenMentFileAddSubmit(_agreenMentFileAddSubmit);

                basePopupViewAgreenmentTime = new XPopup.Builder(ArchiveFileAddSubmitActivity.this)
                        .hasShadowBg(true)
                        .moveUpToKeyboard(false) //如果不加这个，评论弹窗会移动到软键盘上面
                        .isViewMode(true)
                        .isDestroyOnDismiss(true) //对于只使用一次的弹窗，推荐设置这个
                        .isThreeDrag(false) //是否开启三阶拖拽，如果设置enableDrag(false)则无效
                        .asCustom(calendarViewCustomPopup)
                        .show();
            } else {
                //执行异常，空对象
                ToastUtils.showShort(StringUtils.getString(R.string.action_abnormal));
            }
        }

        @Override
        public void modifyAgreeMentPersonName(int _identifierNumber, String _inputPersonName, AgreenMentFileAddSubmit _agreenMentFileAddSubmit) {

//            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "收到-变动【签约人名称】-_identifierNumber-=" + _identifierNumber + "--_inputPersonName=" + _inputPersonName);

            //直接设置 内容
            if (_agreenMentFileAddSubmit != null) {
                _agreenMentFileAddSubmit.setAgreenContactPerson(_inputPersonName);
            }

            //if (mDataResources != null && !mDataResources.isEmpty()) {
//                for (int indexPosition = 0; indexPosition < mDataResources.size(); indexPosition++) {
//                    ModifyMiddleTallAddSubmit modifyMiddleTallAddSubmit = mDataResources.get(indexPosition);
//                    if (_identifierNumber == modifyMiddleTallAddSubmit.getIdentifierNumber()) {
//                        modifyMiddleTallAddSubmit.setCustomerPersonName(_textViewAfterTextChangeEvent);
//                        mDataResources.set(indexPosition, modifyMiddleTallAddSubmit);
//                        break;
//                    }
//                }
//            }

        }

        @Override
        public void modifyAgreementPriceAmont(int _identifierNumber, String _inputPriceAmount, AgreenMentFileAddSubmit _agreenMentFileAddSubmit) {

//            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "收到-变动-整改金额-_identifierNumber-=" + _identifierNumber + "--_inputPriceAmount=" + _inputPriceAmount);

            _agreenMentFileAddSubmit.setAgreenAmountBigDecimalString(_inputPriceAmount);
            _agreenMentFileAddSubmit.setAgreenAmountBigDecimal(CommUtils.formatComma2BigDecimal(_inputPriceAmount));

        }

        @Override
        public void modifyDeleteCurrentItem(int _identifierNumber, AgreenMentFileAddSubmit _agreenMentFileAddSubmit) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "执行删除--执行删除--执行删除--执行删除--");

            KeyboardUtils.hideSoftInput(mActivityInstance);

            //监听删除这条数据；不论是编辑完或者没有编辑完毕的；
            //如果是只有一条数据，右上角的删除 不显示；
            //有个消息弹窗通知
            CommUtils.checkDialog(mAlertView);

            mAlertView = CommUtils.method_showAlertViewTwoButton(mActivityInstance,//
                    StringUtils.getString(R.string.clearcachecancel),//取消
                    StringUtils.getString(R.string.clearcachedelete),//删除
                    StringUtils.getString(R.string.deletesuremessage),//确定删除吗
                    false, new OnItemClickListener() {//
                        @Override
                        public void onItemClick(Object o, int position) {

                            if (position != AlertView.CANCELPOSITION) {

                                if (mDataResources != null && !mDataResources.isEmpty()) {

                                    if (_agreenMentFileAddSubmit != null) {

                                        //如果真要删除它，就清理掉它的旧数据，然后清理
                                        //清空合同类型
                                        _agreenMentFileAddSubmit.setAgreenType("");
                                        //清空签约时间
                                        _agreenMentFileAddSubmit.setAgreenTime("");
                                        //清空签约人
                                        _agreenMentFileAddSubmit.setAgreenContactPerson("");
                                        //清空合同金额
                                        _agreenMentFileAddSubmit.setAgreenAmountBigDecimal(null);
                                        //清空合同金额的汉字格式
                                        _agreenMentFileAddSubmit.setAgreenAmountBigDecimalString("");
                                        //清空合同的附件-的图片的包裹；
                                        if (_agreenMentFileAddSubmit.getFileSingleUpLoadFiles_hashMap() != null) {
                                            _agreenMentFileAddSubmit.getFileSingleUpLoadFiles_hashMap().clear();
                                        }

                                        //清空控件
                                        if (_agreenMentFileAddSubmit.getMaskProgressLayout() != null) {
                                            _agreenMentFileAddSubmit.getMaskProgressLayout().onDestroy();
                                        }

                                        if (agreenMentFileAdapter != null) {

//                                            agreenMentFileAdapter.getData().remove(_agreenMentFileAddSubmit);
//                                            agreenMentFileAdapter.notifyDataSetChanged();

                                            agreenMentFileAdapter.remove(_agreenMentFileAddSubmit);

                                            //要一个遍历内部的
//                                            for (AgreenMentFileAddSubmit agreenMentFileAddSubmit: agreenMentFileAdapter.getData()) {
//
//                                                int indentifierNumber = agreenMentFileAddSubmit.getIdentifierNumber();
//                                                int indentifierNumber_out = _agreenMentFileAddSubmit.getIdentifierNumber();
//
//                                                if (indentifierNumber==indentifierNumber_out){
//                                                    LogUtils.d(ConstantSign.LOGCAT_NOMAL+"即将发生移动-->"+agreenMentFileAdapter.getData().size());
//                                                    agreenMentFileAdapter.getData().remove(agreenMentFileAddSubmit);
//                                                }
//
//                                            }

                                        }

                                        //删除一个之后，就重新备份数据
//                                      methodMoveChangeData();

                                    } else {
                                        ToastUtils.showShort(R.string.deletelowabnomal);
                                    }
                                }
                            }
                        }
                    });

            mAlertView.show();

        }
    };

    //获取车辆的品牌--大范畴-此处添加的是【新车的】车辆品牌；
    private void gainCarBrandLargeCategory(GainDataCallBackListener _gainDataCallBackListener) {

        HashMap<String, Object> map = new HashMap<>();
        map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETCARBRANDFORVEHICLEPAGE);
        addLogUpLoadInfo.setUrlPath(ApiService.getCarBrandForVehiclePage_url);
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .getCarBrandForVehiclePage(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                        MediaType.parse(ApiService.HEADER_JSON)))
                .compose(ArchiveFileAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ArrayList<CarBrandLargeCategory>>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                        //关闭弹窗
                        CommUtils.checkMaterialDialog(materialDialog);
                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {
                        //清理车辆品牌数据库内容
                        CarBrandLargeCategoryDaoManager.getInstance().deleteAllCarBrand();
                        method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);

                    }
                }).subscribe(new Consumer<ArrayList<CarBrandLargeCategory>>() {
                    @Override
                    public void accept(ArrayList<CarBrandLargeCategory> carBrandLargeCategories) throws Throwable {

                        if (mDataResources_carBrandLarge != null && !mDataResources_carBrandLarge.isEmpty()) {
                            mDataResources_carBrandLarge.clear();
                        }

                        if (carBrandLargeCategories != null && !carBrandLargeCategories.isEmpty()) {

                            if (mDataResources_carBrandLarge != null) {

                                mDataResources_carBrandLarge.addAll(carBrandLargeCategories);

                                //先排序 2024年1月26日10:51:26我去掉了排序，因为后台给的数据排在前边的大多是有车系的。
//                              CommUtils.CollectionsSort_CarBrandLargeCategory_CHINA(mDataResources_carBrandLarge);
                                //填充车辆品牌的数据
                                CarBrandLargeCategoryDaoManager.getInstance().insertMultCarBrand(mDataResources_carBrandLarge);

                                //2024-2-19 17:56:58 现场测试要求：默认第一条
//                                carBrandLargeCategory_defaultOne = mDataResources_carBrandLarge.get(0);

                                //-------------------------------------------------------------------------------------
                                Iterator<CarBrandLargeCategory> iterator = mDataResources_carBrandLarge.iterator();

                                if (iterator != null) {

                                    while (iterator.hasNext()) {

                                        CarBrandLargeCategory itemCarBrandLargeCategory = iterator.next();

                                        if (itemCarBrandLargeCategory != null) {

                                            if (itemCarBrandLargeCategory.isDefaultValue()) {//是否是默认店铺内的品牌

                                                //dosomething
                                                itemCarBrandLargeCategory.setChecked(true);
                                                carBrandLargeCategory_defaultOne = itemCarBrandLargeCategory;

//                                                LogUtils.json(ConstantSign.LOGCAT_NOMAL + "该店铺默认的车辆品牌---itemCarBrandLargeCategory-->", itemCarBrandLargeCategory);
//                                                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "该店铺默认的车辆品牌---itemCarBrandLargeCategory-选中状态->", itemCarBrandLargeCategory.isChecked());

                                                break;

                                            } else {
//                                             LogUtils.json(ConstantSign.LOGCAT_NOMAL + "不是这个店铺的默认品牌：店铺的车辆品牌--middleLowAddSubmit",xxx);
                                            }

                                        }
                                    }
                                }
                                //-------------------------------------------------------------------------------------


                                if (carBrandLargeCategory_defaultOne != null) {

//                                    LogUtils.json(ConstantSign.LOGCAT_NOMAL, carBrandLargeCategory_defaultOne);

                                    //因为要取出第一条数据，所以获取完毕第一条车辆品牌的id之后，就立即获取车系；
                                    gainCarBrandSeriesLineSmallCategory(carBrandLargeCategory_defaultOne.getCarBrandId(), null);

                                }

                            }
                        }

                        CommUtils.checkMaterialDialog(materialDialog);

                        //立即获取车系？没有必要
                        if (_gainDataCallBackListener != null) {
                            _gainDataCallBackListener.doSomeThing();
                        }

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {
                        CommUtils.checkMaterialDialog(materialDialog);
                    }
                });

    }

    //获取车辆的车系--小范畴
    private void gainCarBrandSeriesLineSmallCategory(String _carBrandId, GainDataCallBackListener _gainDataCallBackListener) {

        HashMap<String, Object> map = new HashMap<>();
        map.put(Parameterkey.carBrandId, _carBrandId);

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETCARSERIESLIST);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.getCarSeriesList_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .getCarSeriesList(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
                        MediaType.parse(ApiService.HEADER_JSON)))
                .compose(ArchiveFileAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ArrayList<CarBrandSeriesLineSmallCategory>>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                        CommUtils.checkMaterialDialog(materialDialog);
                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {

                        CarBrandSeriesLineDaoManager.getInstance().deleteAllCarSeries();

                        if (_gainDataCallBackListener != null) {
                            method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_LOADING);
                        }

                    }
                }).subscribe(new Consumer<ArrayList<CarBrandSeriesLineSmallCategory>>() {
                    @Override
                    public void accept(ArrayList<CarBrandSeriesLineSmallCategory> carBrandSeriesLineSmallCategories) throws Throwable {

                        CommUtils.checkMaterialDialog(materialDialog);

                        if (mDataResources_carBrandSeriesList != null && !mDataResources_carBrandSeriesList.isEmpty()) {
                            mDataResources_carBrandSeriesList.clear();
                        }

                        if (carBrandSeriesLineSmallCategories != null && !carBrandSeriesLineSmallCategories.isEmpty()) {

                            if (mDataResources_carBrandSeriesList != null) {

                                mDataResources_carBrandSeriesList.addAll(carBrandSeriesLineSmallCategories);
                                //先排序
//                                CommUtils.CollectionsSort_CarBrandSeriesLineSmallCategory_UK(mDataResources_carBrandSeriesList);
//                                CommUtils.CollectionsSort_CarBrandSeriesLineSmallCategory_CHINA(mDataResources_carBrandSeriesList);
                                //filldatas
                                CarBrandSeriesLineDaoManager.getInstance().insertMultCarSeries(mDataResources_carBrandSeriesList);

                            }
                        }

                        if (_gainDataCallBackListener != null) {
                            _gainDataCallBackListener.doSomeThing();
                        }

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {
                        CommUtils.checkMaterialDialog(materialDialog);
                    }
                });

    }

    //获取合同类型
    private void gainContractType(GainDataCallBackListener _gainDataCallBackListener) {

        //
        HashMap<String, Object> map = new HashMap<>();
//        map.put(Parameterkey.carBrandId, _carBrandId);

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_GETLISTBYTYPE);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.getListByType_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
//                .getListByType(RequestBody.create(JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue),
//                        MediaType.parse(ApiService.HEADER_JSON)))
                .getListByType(Parameterkey.vehicle_archive_type)
                .compose(ArchiveFileAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<ArrayList<ArchiveType>>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                    }
                })).subscribe(new Consumer<ArrayList<ArchiveType>>() {
                    @Override
                    public void accept(ArrayList<ArchiveType> archiveTypes) throws Throwable {

                        if (mDataResources_archiveTypeList_forPopu != null && !mDataResources_archiveTypeList_forPopu.isEmpty()) {
                            mDataResources_archiveTypeList_forPopu.clear();
                        }

                        if (archiveTypes != null && !archiveTypes.isEmpty()) {

                            for (ArchiveType archiveType : archiveTypes) {
                                EvaluateWadeInfo evaluateWadeInfo = new EvaluateWadeInfo();
                                evaluateWadeInfo.setDictCode(archiveType.getValue());//前端需要上传给后台的
                                evaluateWadeInfo.setDictLabel(archiveType.getName());

                                if (mDataResources_archiveTypeList_forPopu != null) {
                                    mDataResources_archiveTypeList_forPopu.add(evaluateWadeInfo);
                                }

                            }
                        }

                        //做一次转换为了做合同弹窗的
                        if (_gainDataCallBackListener != null) {
                            _gainDataCallBackListener.doSomeThing();
                        }

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                    }
                });

    }

    @Override
    public void processExtraData() {

        //-----------------------------------------------------------------------------------------
        if (mDataResources_carBrandLarge != null && !mDataResources_carBrandLarge.isEmpty()) {
            mDataResources_carBrandLarge.clear();
        }

        if (mDataResources_archiveFile != null && !mDataResources_archiveFile.isEmpty()) {
            mDataResources_archiveFile.clear();
        }
        //-----------------------------------------------------------------------------------------

        //携带车辆品牌内容
        Bundle extras_bundle = this.getIntent().getExtras();

        if (extras_bundle != null) {

            //flag_jumpfrom_where_type = extras_bundle.getString(ExtraKey.EXTRA_JUMPFROM_WHERE_TYPE);

            //控制动态的附件列表信息
            ArrayList<ArchiveFileType> extra_archiveFileType = extras_bundle.getParcelableArrayList(ExtraKey.EXTRA_FILETYPES_DATAS);

            if (extra_archiveFileType != null && !extra_archiveFileType.isEmpty()) {

                if (mDataResources_archiveFile != null) {

                    mDataResources_archiveFile.addAll(extra_archiveFileType);

                    LogUtils.json(ConstantSign.LOGCAT_NOMAL + "该店铺默认的车辆品牌---itemCarBrandLargeCategory-->", mDataResources_archiveFile);

                    //设置事件监听
//                    MyFooterMaskProgressLayoutListener myFooterMaskProgressLayoutListener = new MyFooterMaskProgressLayoutListener();
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL+"--myFooterMaskProgressLayoutListener-->",myFooterMaskProgressLayoutListener);

                    for (ArchiveFileType archiveFileTypeItem : mDataResources_archiveFile) {

                        MyFooterMaskProgressLayoutListener myFooterMaskProgressLayoutListener = new MyFooterMaskProgressLayoutListener();
                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--myFooterMaskProgressLayoutListener-->", myFooterMaskProgressLayoutListener);

                        myFooterMaskProgressLayoutListener.setModifyArchiveFileType(archiveFileTypeItem);
                        archiveFileTypeItem.setMyFooterMaskProgressLayoutListener(myFooterMaskProgressLayoutListener);

                    }
                }

            }

            //获取控制动态的默认店铺的行为
            ArrayList<CarBrandLargeCategory> extra_carBrandLargeList = extras_bundle.getParcelableArrayList(ExtraKey.EXTRA_CARBRANDLARGE_DATAS);

            if (extra_carBrandLargeList != null && !extra_carBrandLargeList.isEmpty()) {

                //------------------------------------------------------
                if (mDataResources_carBrandLarge != null) {
                    mDataResources_carBrandLarge.addAll(extra_carBrandLargeList);
                }
                //------------------------------------------------------

                if (mDataResources_carBrandLarge != null && !mDataResources_carBrandLarge.isEmpty()) {

                    Iterator<CarBrandLargeCategory> iterator = mDataResources_carBrandLarge.iterator();

                    if (iterator != null) {

                        while (iterator.hasNext()) {

                            CarBrandLargeCategory itemCarBrandLargeCategory = iterator.next();

                            if (itemCarBrandLargeCategory != null) {

                                if (itemCarBrandLargeCategory.isDefaultValue()) {//是否是默认店铺内的品牌
                                    //dosomething
                                    itemCarBrandLargeCategory.setChecked(true);
                                    carBrandLargeCategory_defaultOne = itemCarBrandLargeCategory;
//                                    LogUtils.json(ConstantSign.LOGCAT_NOMAL + "该店铺默认的车辆品牌---itemCarBrandLargeCategory-->", itemCarBrandLargeCategory);
//                                    LogUtils.d(ConstantSign.LOGCAT_NOMAL + "该店铺默认的车辆品牌-选中状态--itemCarBrandLargeCategory选中状态-->", itemCarBrandLargeCategory.isChecked());
                                    break;

                                }

//                                else {
//                                LogUtils.json(ConstantSign.LOGCAT_NOMAL + "不是默认店铺的品牌",itemCarBrandLargeCategory);
//                                }

                            }
                        }
                    }

                }
                //------------------------------------------------------
                //第一条数据取出
//              carBrandLargeCategory_defaultOne = extra_carBrandLargeList.get(0);

            }

//            LogUtils.json(ConstantSign.LOGCAT_NOMAL, carBrandLargeCategory_defaultOne);

//            {
//                    "carBrandId": "10",
//                    "carBrandName": "奥迪",
//                    "sortCode": null
//            }

        }

    }

    /*
     * @Author:itchenqi175@163.com
     * @Time:2023-04-17  20:10
     * @Description:对列表相机的监听
     */
    public class MyMaskProgressLayoutListener implements MaskProgressLayoutListener {

        //直接传递过来这一条数据；因为要填充图片的信息
        private AgreenMentFileAddSubmit agreenMentFileAddSubmitMaskLayout;

        public void setModifyMiddleTallAddSubmit(AgreenMentFileAddSubmit _modifyMiddleTallAddSubmitMaskLayout) {

            //上传单条的图片用；
            agreenMentFileAddSubmitMaskLayout = _modifyMiddleTallAddSubmitMaskLayout;

            //如果是底部的footerview打开的，那么要设置为空值
            agreenMentFileAddSubmitItemWithMaskListener = _modifyMiddleTallAddSubmitMaskLayout;

//            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "监听事件传递过来的- agreenMentFileAddSubmit=>" + agreenMentFileAddSubmitMaskLayout);

        }

        @Override
        public void onItemAdd(@NonNull View view, @NonNull MultiMediaView multiMediaView, //
                              int alreadyImageCount,//
                              int alreadyVideoCount, //
                              int alreadyAudioCount) {//
//            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "onItemAdd--onItemAdd---onItemAdd--onItemAdd");

            //首次添加的添加按钮
            try {

//                public static final String READ_MEDIA_AUDIO = "android.permission.READ_MEDIA_AUDIO";
//                        public static final String READ_MEDIA_IMAGES = "android.permission.READ_MEDIA_IMAGES";
//                        public static final String READ_MEDIA_VIDEO = "android.permission.READ_MEDIA_VIDEO";

                //do
                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {

                    //添加权限提示，人为的提示；
                    if (!AndPermission.hasPermissions(mActivityInstance, Permission.CAMERA)//
                            || !AndPermission.hasPermissions(mActivityInstance, Permission.WRITE_EXTERNAL_STORAGE)//
                            || !AndPermission.hasPermissions(mActivityInstance, Permission.READ_EXTERNAL_STORAGE)) {//

                        CommUtils.checkMaterialDialog(materialDialog);

                        materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_CAMERA_STORAGE, new AuthorityCallbackListener() {
                            @Override
                            public void doSomeThing() {

                                CommUtils.checkMaterialDialog(materialDialog);

                                //添加访问权限内容
                                AndPermission.with(ArchiveFileAddSubmitActivity.this)
                                        .runtime()//
                                        .permission(Permission.CAMERA,
                                                Permission.READ_EXTERNAL_STORAGE, //
                                                Permission.WRITE_EXTERNAL_STORAGE)//
                                        .rationale(new RuntimeRationale())//
                                        .onGranted(new com.yanzhenjie.permission.Action<List<String>>() {
                                            @Override
                                            public void onAction(List<String> permissions) {

                                                //直接的执行,仅仅拍照+录视频
                                                openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                                            }
                                        }).onDenied(new com.yanzhenjie.permission.Action<List<String>>() {
                                            @Override
                                            public void onAction(List<String> permissions) {

                                                ToastUtils.showShort(ConstantSign.NEEDPERMISS_PHONE);

                                                if (AndPermission.hasAlwaysDeniedPermission(ArchiveFileAddSubmitActivity.this, permissions)) {
                                                    mSetting.showSetting(ConstantApi.PERMISSION_NORMAL, ArchiveFileAddSubmitActivity.this, permissions);
                                                }

                                            }
                                        }).start();


                            }
                        });

                    } else {

//                      LogUtils.d(ConstantSign.LOGCAT_NOMAL + "正常的权限已经打开，可以执行拍照操作");
                        //直接的执行,仅仅拍照+录视频
                        openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                    }

                } else {

//                        public static final String READ_MEDIA_AUDIO = "android.permission.READ_MEDIA_AUDIO";
//                        public static final String READ_MEDIA_IMAGES = "android.permission.READ_MEDIA_IMAGES";
//                        public static final String READ_MEDIA_VIDEO = "android.permission.READ_MEDIA_VIDEO";
                    //首次添加的添加按钮
                    //添加权限提示，人为的提示；
                    if (!XXPermissions.isGranted(ArchiveFileAddSubmitActivity.this, com.hjq.permissions.Permission.CAMERA)
                            || !XXPermissions.isGranted(ArchiveFileAddSubmitActivity.this, com.hjq.permissions.Permission.READ_MEDIA_IMAGES)) {

                        CommUtils.checkMaterialDialog(materialDialog);

                        materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_CAMERA_STORAGE, new AuthorityCallbackListener() {
                            @Override
                            public void doSomeThing() {

                                CommUtils.checkMaterialDialog(materialDialog);

                                XXPermissions.with(ArchiveFileAddSubmitActivity.this)
                                        // 适配分区存储应该这样写
                                        //.permission(Permission.Group.STORAGE)
                                        // 不适配分区存储应该这样写
                                        .permission(com.hjq.permissions.Permission.CAMERA)//
                                        .permission(com.hjq.permissions.Permission.READ_MEDIA_IMAGES)//
//                                    .permission(com.hjq.permissions.Permission.READ_MEDIA_VIDEO)//
//                                    .permission(com.hjq.permissions.Permission.READ_MEDIA_AUDIO)//
                                        //).permission(com.hjq.permissions.Permission.MANAGE_EXTERNAL_STORAGE
//                                                        .interceptor(new PermissionInterceptor())
                                        .request(new OnPermissionCallback() {

                                            @Override
                                            public void onGranted(@NonNull List<String> permissions, boolean allGranted) {

                                                if (!allGranted) {
                                                    // TODO: 2024/1/23 18:50 权限这里要不要给提示？权限没通过

                                                    return;
                                                }

                                                Toaster.show(String.format(getString(R.string.demo_obtain_permission_success_hint),
                                                        PermissionNameConvert.getPermissionString(ArchiveFileAddSubmitActivity.this, permissions)));

                                                openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                                            }
                                        });


                            }
                        });

                    } else {

//                      LogUtils.d(ConstantSign.LOGCAT_NOMAL + "正常的权限已经打开，可以执行拍照操作");
                        //直接的执行,仅仅拍照+录视频
                        openMain(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);
                    }

                }

            } catch (Exception e) {
                //catch
                e.printStackTrace();
            }

        }

        @Override
        public void onAddDataSuccess(@NonNull List<MultiMediaView> list) {

        }


        @Override
        public void onItemAudioStartDownload(@NonNull View view, @NonNull String s) {

        }

        @Override
        public void onItemClick(@NonNull View view, @NonNull MultiMediaView multiMediaView) {

            //各个条目的点击事件内容
//            if (multiMediaView.isImageOrGif() || multiMediaView.isVideo()) {//
//                mGlobalSetting.openPreviewData(ModifyMiddleTallDangerAddSubmitActivity.this, REQUEST_CODE_CHOOSE,
//                        mplImageListInMiddleLow.getImagesAndVideos(),//
//                        mplImageListInMiddleLow.getImagesAndVideos().//
//                                indexOf(multiMediaView));//
//            }

            try {
                //do
                if (multiMediaView.isImageOrGif() || multiMediaView.isVideo()) {//

                    if (agreenMentFileAddSubmitMaskLayout != null) {

                        if (mGlobalSetting != null) {

                            mGlobalSetting.openPreviewData(ArchiveFileAddSubmitActivity.this, REQUEST_CODE_CHOOSE,
                                    agreenMentFileAddSubmitMaskLayout.getMaskProgressLayout().getImagesAndVideos(),//
                                    agreenMentFileAddSubmitMaskLayout.getMaskProgressLayout().getImagesAndVideos().//
                                            indexOf(multiMediaView));//
                        } else {
                            ToastUtils.showShort(StringUtils.getString(R.string.globalsettingnull));
                        }
                    }

                }

            } catch (Exception e) {
                //catch
                e.printStackTrace();
            }

        }

        @Override
        public void onItemClose(@NonNull View view, @NonNull MultiMediaView multiMediaView) {

            //这里的删除也依然是单条数据的删除；
            try {

                //do
                if (multiMediaView != null) {

                    //是否要区分：是【添加图片】还是【从详情里取到的图片】
                    String filePath = multiMediaView.getPath();
                    //LogUtils.d(ConstantSign.LOGCAT_NOMAL + "---filePath-->" + filePath);
                    //itchen-->---filePath-->/storage/emulated/0/middlelow/IMAGE_20230512_173801068.jpg
                    String getCurrentFileShortName = CommUtils.valueStringSplit(filePath);

                    if (agreenMentFileAddSubmitItemWithMaskListener.getFileSingleUpLoadFiles_hashMap() != null && !agreenMentFileAddSubmitItemWithMaskListener.getFileSingleUpLoadFiles_hashMap().isEmpty()) {

                        //遍历循环装载HashMap的list
                        Iterator<HashMap<String, Object>> iterator = agreenMentFileAddSubmitItemWithMaskListener.getFileSingleUpLoadFiles_hashMap().iterator();

                        if (iterator != null) {

                            while (iterator.hasNext()) {

                                HashMap<String, Object> hashMapItem = iterator.next();

                                if (hashMapItem != null) {

                                    String file_short_name_local = (String) hashMapItem.get(Parameterkey.file_name);

                                    if (!TextUtils.isEmpty(getCurrentFileShortName) && !TextUtils.isEmpty(file_short_name_local)) {
                                        if (TextUtils.equals(getCurrentFileShortName, file_short_name_local)) {
                                            agreenMentFileAddSubmitItemWithMaskListener.getFileSingleUpLoadFiles_hashMap().remove(hashMapItem);
//                                            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "即将删除--新增的-本地数据-hashMapItem-->" , hashMapItem);
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }

                }

            } catch (Exception e) {
                //catch
                e.printStackTrace();
            }

        }

        @Override
        public void onItemStartUploading(@NonNull MultiMediaView multiMediaView) {

            //开始上传；

        }

        @Override
        public boolean onItemVideoStartDownload(@NonNull View view, @NonNull MultiMediaView multiMediaView) {
            return false;
        }
    }

    /*
     * @Author:itchenqi175@163.com
     * @Time:2023-04-18  14:58
     * @Description: 底部的【档案管理】底部视图的添加打开相机等权限；
     */
    public class MyFooterMaskProgressLayoutListener implements MaskProgressLayoutListener {

        //携带这条九宫格的实体，主要用于内侧监听，在MyFooterMaskProgressLayoutListener内部使用；
        private ArchiveFileType archiveFileTypeMaskLayout;

        public void setModifyArchiveFileType(ArchiveFileType _archiveFileType_current_Item) {

            archiveFileTypeMaskLayout = _archiveFileType_current_Item;
//            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "archiveFileTypeMaskLayout-单个填充的九宫格监听器->", archiveFileTypeMaskLayout);

            //外侧监听
//            footerArchiveFileTypeWithMaskListener = _archiveFileType_current_Item;
//            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "footerArchiveFileTypeWithMaskListener-->", footerArchiveFileTypeWithMaskListener);

        }

        @Override
        public void onItemAdd(@NonNull View view, @NonNull MultiMediaView multiMediaView, //
                              int alreadyImageCount,//
                              int alreadyVideoCount, //
                              int alreadyAudioCount) {//

            if (archiveFileTypeMaskLayout != null) {
                footerArchiveFileTypeWithMaskListener = archiveFileTypeMaskLayout;
                LogUtils.json(ConstantSign.LOGCAT_NOMAL + "那末当前正在操作的-footerArchiveFileTypeWithMaskListener->", footerArchiveFileTypeWithMaskListener);
            }

            try {

                //do
                if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {

                    //首次添加的添加按钮
                    //添加权限提示，人为的提示；
                    if (!AndPermission.hasPermissions(mActivityInstance, Permission.CAMERA)//
                            || !AndPermission.hasPermissions(mActivityInstance, Permission.WRITE_EXTERNAL_STORAGE)//
                            || !AndPermission.hasPermissions(mActivityInstance, Permission.READ_EXTERNAL_STORAGE)//
                    ) {//

                        CommUtils.checkMaterialDialog(materialDialog);
                        materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_CAMERA_STORAGE, new AuthorityCallbackListener() {
                            @Override
                            public void doSomeThing() {

                                //添加访问权限内容
                                AndPermission.with(ArchiveFileAddSubmitActivity.this)
                                        .runtime()//
                                        .permission(Permission.CAMERA,
                                                Permission.READ_EXTERNAL_STORAGE, //
                                                Permission.WRITE_EXTERNAL_STORAGE
                                        )//
                                        .rationale(new RuntimeRationale())//
                                        .onGranted(new com.yanzhenjie.permission.Action<List<String>>() {
                                            @Override
                                            public void onAction(List<String> permissions) {

                                                //直接的执行,仅仅拍照+录视频
                                                openMainFooterView(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);


                                            }
                                        }).onDenied(new com.yanzhenjie.permission.Action<List<String>>() {
                                            @Override
                                            public void onAction(List<String> permissions) {

                                                ToastUtils.showShort(ConstantSign.NEEDPERMISS_PHONE);

                                                if (AndPermission.hasAlwaysDeniedPermission(ArchiveFileAddSubmitActivity.this, permissions)) {
                                                    mSetting.showSetting(ConstantApi.PERMISSION_NORMAL, ArchiveFileAddSubmitActivity.this, permissions);
                                                }

                                            }
                                        }).start();

                                CommUtils.checkMaterialDialog(materialDialog);

                            }
                        });

                    } else {

//                      LogUtils.d(ConstantSign.LOGCAT_NOMAL + "footerview 正常的权限已经打开，可以执行拍照操作");
                        //直接的执行,仅仅拍照+录视频
                        openMainFooterView(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                    }

                } else {

                    //添加权限提示，人为的提示；
                    if (!XXPermissions.isGranted(ArchiveFileAddSubmitActivity.this, com.hjq.permissions.Permission.CAMERA)
                            || !XXPermissions.isGranted(ArchiveFileAddSubmitActivity.this, com.hjq.permissions.Permission.READ_MEDIA_IMAGES)) {//

                        CommUtils.checkMaterialDialog(materialDialog);

                        materialDialog = CommUtils.authorityRequest(mActivityInstance, ConstantSign.MATERIALDIALOG_AUTHORITY_CONTENT_CAMERA_STORAGE, new AuthorityCallbackListener() {
                            @Override
                            public void doSomeThing() {

                                CommUtils.checkMaterialDialog(materialDialog);

                                XXPermissions.with(ArchiveFileAddSubmitActivity.this)
                                        // 适配分区存储应该这样写
                                        //.permission(Permission.Group.STORAGE)
                                        // 不适配分区存储应该这样写
                                        .permission(com.hjq.permissions.Permission.CAMERA)//
                                        .permission(com.hjq.permissions.Permission.READ_MEDIA_IMAGES)//
//                                    .permission(com.hjq.permissions.Permission.READ_MEDIA_VIDEO)//
//                                    .permission(com.hjq.permissions.Permission.READ_MEDIA_AUDIO)//
                                        //).permission(com.hjq.permissions.Permission.MANAGE_EXTERNAL_STORAGE
//                                     .interceptor(new PermissionInterceptor())
                                        .request(new OnPermissionCallback() {

                                            @Override
                                            public void onGranted(@NonNull List<String> permissions, boolean allGranted) {

                                                if (!allGranted) {
                                                    // TODO: 2024/1/23 18:50 权限这里要不要给提示？权限没通过

                                                    return;
                                                }

                                                Toaster.show(String.format(getString(R.string.demo_obtain_permission_success_hint),
                                                        PermissionNameConvert.getPermissionString(ArchiveFileAddSubmitActivity.this, permissions)));

                                                //直接的执行,仅仅拍照+录视频
                                                openMainFooterView(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);


                                            }
                                        });
                            }
                        });

                    } else {

//                      LogUtils.d(ConstantSign.LOGCAT_NOMAL + "footerview 正常的权限已经打开，可以执行拍照操作");
                        //直接的执行,仅仅拍照+录视频
                        openMainFooterView(alreadyImageCount, alreadyVideoCount, alreadyAudioCount);

                    }

                }

            } catch (Exception e) {
                //catch
                e.printStackTrace();
            }

        }

        @Override
        public void onAddDataSuccess(@NonNull List<MultiMediaView> list) {

        }

        @Override
        public void onItemAudioStartDownload(@NonNull View view, @NonNull String s) {

        }

        @Override
        public void onItemClick(@NonNull View view, @NonNull MultiMediaView multiMediaView) {

            try {
                //do
                if (multiMediaView.isImageOrGif() || multiMediaView.isVideo()) {//

//                    if (mplimageListInArchiveCheckFooterView != null) {

                    if (mGlobalSettingFooterView != null) {

                        mGlobalSettingFooterView.openPreviewData(ArchiveFileAddSubmitActivity.this, REQUEST_CODE_CHOOSE_FOOTERVIEW,
                                archiveFileTypeMaskLayout.getMaskProgressLayoutInItem().getImagesAndVideos(),//
                                archiveFileTypeMaskLayout.getMaskProgressLayoutInItem().getImagesAndVideos().//
                                        indexOf(multiMediaView));//
                    } else {
                        ToastUtils.showShort(StringUtils.getString(R.string.globalsettingnull));
                    }
//                    }

                }

            } catch (Exception e) {
                //catch
                e.printStackTrace();
            }

        }

        @Override
        public void onItemClose(@NonNull View view, @NonNull MultiMediaView multiMediaView) {

            try {
                //do

                if (multiMediaView != null) {

                    //是否要区分：是【添加图片】还是【从详情里取到的图片】
                    String filePath = multiMediaView.getPath();
                    //LogUtils.d(ConstantSign.LOGCAT_NOMAL + "---filePath-->" + filePath);
                    //itchen-->---filePath-->/storage/emulated/0/middlelow/IMAGE_20230512_173801068.jpg
                    String getCurrentFileShortName = CommUtils.valueStringSplit(filePath);

                    if (footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap() != null && !footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap().isEmpty()) {

                        //遍历循环装载HashMap的list
                        Iterator<HashMap<String, Object>> iterator = footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap().iterator();

                        if (iterator != null) {

                            while (iterator.hasNext()) {

                                HashMap<String, Object> hashMapItem = iterator.next();

                                if (hashMapItem != null) {

                                    String file_short_name_local = (String) hashMapItem.get(Parameterkey.file_name);

                                    if (!TextUtils.isEmpty(getCurrentFileShortName) && !TextUtils.isEmpty(file_short_name_local)) {

                                        if (TextUtils.equals(getCurrentFileShortName, file_short_name_local)) {

                                            footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap().remove(hashMapItem);

                                            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "即将删除--新增的-本地数据-footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap()-->", hashMapItem);

                                            break;
                                        }

                                    }

                                }
                            }
                        }
                    }

                }

            } catch (Exception e) {
                //catch
                e.printStackTrace();
            }

        }

        @Override
        public void onItemStartUploading(@NonNull MultiMediaView multiMediaView) {

        }

        @Override
        public boolean onItemVideoStartDownload(@NonNull View view, @NonNull MultiMediaView multiMediaView) {
            return false;
        }
    }

    /**
     * 公共的打开多媒体事件
     *
     * @param alreadyImageCount 已经存在的图片
     * @param alreadyVideoCount 已经存在的语音
     * @param alreadyAudioCount 已经存在的视频
     */
    private void openMain(int alreadyImageCount, int alreadyVideoCount, int alreadyAudioCount) {

        // 拍摄有关设置
        CameraSetting cameraSetting = new CameraSetting();
        // 支持的类型：图片，视频
        //cameraSetting.mimeTypeSet(MimeType.ofAll());
        cameraSetting.mimeTypeSet(MimeType.ofImage());

        // 相册
        AlbumSetting albumSetting = new AlbumSetting(false)
                // 支持的类型：图片，视频
                .mimeTypeSet(MimeType.ofImage())
                // 是否显示多选图片的数字
                .countable(true)
                // 自定义过滤器
                .addFilter(new GifSizeFilter(320, 320, 5 * BaseFilter.K * BaseFilter.K))
                // 开启原图
                .originalEnable(true)
                // 最大原图size,仅当originalEnable为true的时候才有效
                .maxOriginalSize(10);

        // 录音机
        //RecorderSetting recorderSetting = new RecorderSetting();

        // 全局
        mGlobalSetting = MultiMediaSetting.from(ArchiveFileAddSubmitActivity.this).choose(MimeType.ofImage());

        //开启相册能力
        mGlobalSetting.albumSetting(albumSetting);

//        if (mBinding.cbAlbum.isChecked()) {
//            // 开启相册功能
//            mGlobalSetting.albumSetting(albumSetting);
//        }
        // 开启拍摄功能
        mGlobalSetting.cameraSetting(cameraSetting);

//        if (mBinding.cbRecorder.isChecked()) {
//            // 开启录音功能
//            mGlobalSetting.recorderSetting(recorderSetting);
//        }

        mGlobalSetting
                // 设置路径和7.0保护路径等等
                .allStrategy(new SaveStrategy(true,//
                        ConstantSign.FILE_PROVIDER, //fileProvider
                        ConstantSign.FOLDER_MIDDLELOW))//
                // for glide-V4
                .imageEngine(new Glide4Engine())
                .isImageEdit(false)//禁止图片编辑
                // 最大5张图片、最大3个视频、最大1个音频
                .maxSelectablePerMediaType(null,
                        ConstantApi.MAX_IMAGE_SELECTABLE,//5个图片，整体设置；
                        ConstantApi.MAX_VIDEO_SELECTABLE,
                        ConstantApi.MAX_AUDIO_SELECTABLE,
                        alreadyImageCount,
                        alreadyVideoCount,
                        alreadyAudioCount)
                .forResult(REQUEST_CODE_CHOOSE);
    }

    /**
     * 公共的打开多媒体事件
     *
     * @param alreadyImageCount 已经存在的图片
     * @param alreadyVideoCount 已经存在的语音
     * @param alreadyAudioCount 已经存在的视频
     */
    private void openMainFooterView(int alreadyImageCount, int alreadyVideoCount, int alreadyAudioCount) {

        // 拍摄有关设置
        CameraSetting cameraSetting = new CameraSetting();
        // 支持的类型：图片，视频
        //cameraSetting.mimeTypeSet(MimeType.ofAll());
        cameraSetting.mimeTypeSet(MimeType.ofImage());

        // 相册
        AlbumSetting albumSetting = new AlbumSetting(false)
                // 支持的类型：图片，视频
                .mimeTypeSet(MimeType.ofImage())
                // 是否显示多选图片的数字
                .countable(true)
                // 自定义过滤器
                .addFilter(new GifSizeFilter(320, 320, 5 * BaseFilter.K * BaseFilter.K))
                // 开启原图
                .originalEnable(true)
                // 最大原图size,仅当originalEnable为true的时候才有效h
                .maxOriginalSize(10);

        // 录音机
        //RecorderSetting recorderSetting = new RecorderSetting();

        // 全局
        mGlobalSettingFooterView = MultiMediaSetting.from(ArchiveFileAddSubmitActivity.this).choose(MimeType.ofImage());
        mGlobalSettingFooterView.albumSetting(albumSetting);

//        if (mBinding.cbAlbum.isChecked()) {
//            // 开启相册功能
//            mGlobalSetting.albumSetting(albumSetting);
//        }

        // 开启拍摄功能
        mGlobalSettingFooterView.cameraSetting(cameraSetting);

//        if (mBinding.cbRecorder.isChecked()) {
//            // 开启录音功能
//            mGlobalSetting.recorderSetting(recorderSetting);
//        }

        mGlobalSettingFooterView
                // 设置路径和7.0保护路径等等
                .allStrategy(new SaveStrategy(true,//
                        ConstantSign.FILE_PROVIDER, //fileProvider
                        ConstantSign.FOLDER_MIDDLELOW))//
                // for glide-V4
                .imageEngine(new Glide4Engine())
                .isImageEdit(false)//不编辑图片
                // 最大5张图片、最大3个视频、最大1个音频
                .maxSelectablePerMediaType(null,
                        ConstantApi.MAX_IMAGE_SELECTABLE,//5个图片，整体设置；
                        ConstantApi.MAX_VIDEO_SELECTABLE,
                        ConstantApi.MAX_AUDIO_SELECTABLE,
                        alreadyImageCount,
                        alreadyVideoCount,
                        alreadyAudioCount)
                .forResult(REQUEST_CODE_CHOOSE_FOOTERVIEW);
    }


    //初始化相关配置
    private void initConfig() {

        // 拍摄有关设置
        CameraSetting cameraSetting = new CameraSetting();
        // 支持的类型：图片，视频
        cameraSetting.mimeTypeSet(MimeType.ofImage());
        // 相册
        AlbumSetting albumSetting = new AlbumSetting(true)
                // 支持的类型：图片，视频
                .mimeTypeSet(MimeType.ofImage())
                // 仅仅显示一个多媒体类型
                .showSingleMediaType(true)
                // 是否显示多选图片的数字
                .countable(true)
                // 自定义过滤器
                .addFilter(new GifSizeFilter(320, 320, 5 * BaseFilter.K * BaseFilter.K))
                // 九宫格大小
                .gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size))
                // 图片缩放比例
                .thumbnailScale(0.85f)
                .setOnSelectedListener(localFiles -> {
                    // 每次选择的事件
//                    LogUtils.d("itchen---onSelected", "onSelected: localFiles.size()=" + localFiles.size());
                })
                // 开启原图
                .originalEnable(true)
                // 最大原图size,仅当originalEnable为true的时候才有效
                .maxOriginalSize(1)
                .setOnCheckedListener(isChecked -> {
                    // 是否勾选了原图
//                    LogUtils.d("itchen----isChecked", "onCheck: isChecked=" + isChecked);
                });
        // 录音机
//        RecorderSetting recorderSetting = new RecorderSetting();
        // 全局
        mGlobalSetting = MultiMediaSetting.from(ArchiveFileAddSubmitActivity.this)
                .choose(MimeType.ofImage())
                .albumSetting(albumSetting)
                .cameraSetting(cameraSetting)
                .isImageEdit(false)//不编辑图片
//                .recorderSetting(recorderSetting)
                // 设置路径和7.0保护路径等等
                .allStrategy(new SaveStrategy(true, ConstantSign.FILE_PROVIDER, "AA/test"))
                // 如果设置这个，有关图片的优先权比allStrategy高
                .pictureStrategy(new SaveStrategy(true, ConstantSign.FILE_PROVIDER, "AA/picture"))
                // 如果设置这个，有关音频的优先权比allStrategy高
                //.audioStrategy(new SaveStrategy(true, "com.ygxsk.integrated.fileprovider", "AA/audio"))
                // 如果设置这个，有关视频的优先权比allStrategy高
                .videoStrategy(new SaveStrategy(true, ConstantSign.FILE_PROVIDER, "AA/video"))
                //  .imageEngine(new GlideEngine())  // for glide-V3     // for glide-V4
                .imageEngine(new Glide4Engine());
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (resultCode != RESULT_OK) {
            return;
        }

        if (requestCode == REQUEST_CODE_CHOOSE) {
            //备注：是正常的条目上的标志；

            if (data.getBooleanExtra(BasePreviewActivity.EXTRA_RESULT_APPLY, false)) {

                // 获取选择的数据
                ArrayList<MultiMedia> selected = MultiMediaSetting.obtainMultiMediaResult(data);
//              LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--selected--的值内容-->" + selected);

                if (selected == null) {
                    return;
                }

                if (agreenMentFileAddSubmitItemWithMaskListener != null) {

                    // TODO: 2023-04-18 09:27  这一块真的有相册的选择怎么办？

                    // 循环判断，如果不存在，则删除
                    for (int i = agreenMentFileAddSubmitItemWithMaskListener.getMaskProgressLayout().getImagesAndVideos().size() - 1; i >= 0; i--) {

                        int k = 0;

                        for (MultiMedia multiMedia : selected) {
                            if (!agreenMentFileAddSubmitItemWithMaskListener.getMaskProgressLayout().getImagesAndVideos().get(i).equals(multiMedia)) {
                                k++;
                            }
                        }

                        if (k == selected.size()) {
                            // 所有都不符合，则删除
                            agreenMentFileAddSubmitItemWithMaskListener.getMaskProgressLayout().removePosition(i);
                        }

                    }
                }

            } else {

                List<LocalFile> result = MultiMediaSetting.obtainLocalFileResult(data);

                ArrayList<String> listUpLoad = new ArrayList<>();

                for (LocalFile localFile : result) {
                    // 绝对路径,AndroidQ如果存在不属于自己App下面的文件夹则无效
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult id:" + localFile.getId());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 绝对路径:" + localFile.getPath());
                    //绝对路径:/storage/emulated/0/middlelow/IMAGE_20230418_081811299.jpg
                    ///storage/emulated/0/middlelow/IMAGE_20230404_155336703.jpg
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 旧图路径:" + localFile.getOldPath());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 原图路径:" + localFile.getOriginalPath());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult Uri:" + localFile.getUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 旧图Uri:" + localFile.getOldUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 原图Uri:" + localFile.getOriginalUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 文件大小: " + localFile.getSize());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 视频音频长度: " + localFile.getDuration());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 是否选择了原图: " + localFile.isOriginal());
//                    if (localFile.isImageOrGif()) {
//                        if (localFile.isImage()) {
//                            LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 图片类型");
//                        } else if (localFile.isImage()) {
//                            LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 图片类型");
//                        }
//                    } else if (localFile.isVideo()) {
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 视频类型");
//                    } else if (localFile.isAudio()) {
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 音频类型");
//                    }
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 具体类型:" + localFile.getMimeType());

                    // 某些手机拍摄没有自带宽高，那么我们可以自己获取
                    if (localFile.getWidth() == 0 && localFile.isVideo()) {

                        MediaExtraInfo mediaExtraInfo = MediaUtils.getVideoSize(getApplication(), localFile.getPath());
                        localFile.setWidth(mediaExtraInfo.getWidth());
                        localFile.setHeight(mediaExtraInfo.getHeight());
                        localFile.setDuration(mediaExtraInfo.getDuration());

                    }

//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 宽高: " + localFile.getWidth() + "x" + localFile.getHeight());


                    if (!TextUtils.isEmpty(localFile.getPath())) {
                        listUpLoad.add(localFile.getPath());
                    }

                }

                //------------------------------------------------------------------------------------------------------------------------
                // TODO: 2023-04-18 08:06 单独刷新对应条目的传递图片
                if (agreenMentFileAdapter != null) {
                    int indexPosition = agreenMentFileAdapter.getItemPosition(agreenMentFileAddSubmitItemWithMaskListener) + agreenMentFileAdapter.getHeaderLayoutCount();
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL + "indexPosition-->" + indexPosition);
                    MaskProgressLayout mplImagelistInMiddleTallItem = (MaskProgressLayout) agreenMentFileAdapter.getViewByPosition(indexPosition, R.id.mplimagelistinagreenmentadapter);

                    if (mplImagelistInMiddleTallItem != null) {

                        mplImagelistInMiddleTallItem.post(new Runnable() {
                            @Override
                            public void run() {
                                //内部过滤了视频或者图片
                                mplImagelistInMiddleTallItem.addLocalFileStartUpload(result);
                            }
                        });
                    }
                }

                //------------------------------------------------------------------------------------------------------------------------
                //添加上传的内容的，间隔500毫秒上传一个；
                //数据的对象
                method_observer_upLoadFile(listUpLoad, REQUEST_CODE_CHOOSE, ConstantApi.SKIP_TYPE);

                //------------------------------------------------------------------------------------------------------------------------
            }


        } else if (requestCode == REQUEST_CODE_CHOOSE_FOOTERVIEW) {

            //备注：footerview 相机的处理,由于 footerView 的布局是

            // 如果是在预览界面点击了确定
            if (data.getBooleanExtra(BasePreviewActivity.EXTRA_RESULT_APPLY, false)) {

                // 获取选择的数据
                ArrayList<MultiMedia> selected = MultiMediaSetting.obtainMultiMediaResult(data);
//                LogUtils.d(ConstantSign.LOGCAT_NOMAL + "--selected--的值内容-->" + selected);

                if (selected == null) {
                    return;
                }

                if (footerArchiveFileTypeWithMaskListener != null) {

                    // 循环判断，如果不存在，则删除
                    for (int i = footerArchiveFileTypeWithMaskListener.getMaskProgressLayoutInItem().getImagesAndVideos().size() - 1; i >= 0; i--) {

                        int k = 0;

                        for (MultiMedia multiMedia : selected) {
                            if (!footerArchiveFileTypeWithMaskListener.getMaskProgressLayoutInItem().getImagesAndVideos().get(i).equals(multiMedia)) {
                                k++;
                            }
                        }

                        if (k == selected.size()) {
                            // 所有都不符合，则删除
                            footerArchiveFileTypeWithMaskListener.getMaskProgressLayoutInItem().removePosition(i);
                        }

                    }
                }

            } else {

                List<LocalFile> result = MultiMediaSetting.obtainLocalFileResult(data);

                ArrayList<String> listUpLoad = new ArrayList<>();

                for (LocalFile localFile : result) {

                    // 绝对路径,AndroidQ如果存在不属于自己App下面的文件夹则无效
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult id:" + localFile.getId());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 绝对路径:" + localFile.getPath());
//                    ///storage/emulated/0/middlelow/IMAGE_20230404_155336703.jpg
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 旧图路径:" + localFile.getOldPath());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 原图路径:" + localFile.getOriginalPath());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult Uri:" + localFile.getUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 旧图Uri:" + localFile.getOldUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 原图Uri:" + localFile.getOriginalUri());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 文件大小: " + localFile.getSize());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 视频音频长度: " + localFile.getDuration());
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 是否选择了原图: " + localFile.isOriginal());

//                    if (localFile.isImageOrGif()) {
//                        if (localFile.isImage()) {
//                            LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 图片类型");
//                        } else if (localFile.isImage()) {
//                            LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 图片类型");
//                        }
//                    } else if (localFile.isVideo()) {
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 视频类型");
//                    } else if (localFile.isAudio()) {
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 音频类型");
//                    }

//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 具体类型:" + localFile.getMimeType());

                    // 某些手机拍摄没有自带宽高，那么我们可以自己获取
//                    if (localFile.getWidth() == 0 && localFile.isVideo()) {
//
//                        MediaExtraInfo mediaExtraInfo = MediaUtils.getVideoSize(getApplication(), localFile.getPath());
//                        localFile.setWidth(mediaExtraInfo.getWidth());
//                        localFile.setHeight(mediaExtraInfo.getHeight());
//                        localFile.setDuration(mediaExtraInfo.getDuration());
//
//                    }
//
//                    LogUtils.d(ConstantSign.LOGCAT_NOMAL, "onResult 宽高: " + localFile.getWidth() + "x" + localFile.getHeight());

                    if (!TextUtils.isEmpty(localFile.getPath())) {
                        listUpLoad.add(localFile.getPath());
                    }

                }

                //------------------------------------------------------------------------------------------------------------------------
                // TODO: 2024/2/22 14:42 因为这是适配器内部的小九宫格的图片填充，需要找出这条实体数据，进行填充
//                if (mplimageListInArchiveCheckFooterView != null) {
//                    mplimageListInArchiveCheckFooterView.addLocalFileStartUpload(result);
//                }

                if (footerModifyAddSubmitArchiveFileTypeAdapter != null) {

                    //这么取出 那么永远都是最后一个：
                    int indexPosition = footerModifyAddSubmitArchiveFileTypeAdapter.getItemPosition(footerArchiveFileTypeWithMaskListener) + footerModifyAddSubmitArchiveFileTypeAdapter.getHeaderLayoutCount();
                    LogUtils.d(ConstantSign.LOGCAT_NOMAL + "indexPosition-->" + indexPosition);
//                    //footerview之中的九宫格的填充
                    MaskProgressLayout mplImagelistInFooterViewItem = (MaskProgressLayout) footerModifyAddSubmitArchiveFileTypeAdapter.getViewByPosition(indexPosition, R.id.mplimagelistinarchivetype);
//
                    if (mplImagelistInFooterViewItem != null) {
//
//                    footerArchiveFileTypeWithMaskListener.getMaskProgressLayoutInItem().post(new Runnable() {
//                            @Override
//                            public void run() {
//                                //内部过滤了视频或者图片
//                                footerArchiveFileTypeWithMaskListener.getMaskProgressLayoutInItem().addLocalFileStartUpload(result);
//                            }
//                        });

                        mplImagelistInFooterViewItem.addLocalFileStartUpload(result);

                    }

                    //----------------------------------------------------------------------------------------------------------------------------------------------

                    LogUtils.d(ConstantSign.LOGCAT_NOMAL + "当前的附件类型是-->" + footerArchiveFileTypeWithMaskListener.getFileType());

                    method_observer_upLoadFile(listUpLoad, REQUEST_CODE_CHOOSE_FOOTERVIEW, footerArchiveFileTypeWithMaskListener.getFileType());

                    //----------------------------------------------------------------------------------------------------------------------------------------------

                }


            }

        }

    }


    /**
     * @param listUpLoad 合并的通用的上传图片的方法
     */
    private void method_observer_upLoadFile(ArrayList<String> listUpLoad, int _actionItemOrFooterView, int _fileType) {

        //添加上传的内容的，间隔500毫秒上传一个；
        //数据的对象
        Observable<String> dataA = Observable.fromIterable(listUpLoad).subscribeOn(AndroidSchedulers.mainThread());
        //时间的对象,给N秒时间，因为要处理 3 个接口
        Observable<Long> timeB = Observable.interval(ConstantApi.UPLOAD_TIME_INTERVAL, TimeUnit.MILLISECONDS).subscribeOn(AndroidSchedulers.mainThread());
        //合并
        mCompositeDisposable.add(Observable.zip(dataA, timeB, new BiFunction<String, Long, String>() {

                    @Override
                    public String apply(String sValueUpLoadFilter, Long aLongValue) throws Throwable {
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "转换之后的地址是-->" + sValueUpLoadFilter);
                        return aLongValue + ConstantSign.SPLIT_SYMBOL + sValueUpLoadFilter;
                    }
                }).subscribeOn(AndroidSchedulers.mainThread())//
                .observeOn(AndroidSchedulers.mainThread())//
                .subscribe(new Consumer<String>() {
                    @Override
                    public void accept(String sValueUpLoad) throws Throwable {

                        //传递是第几张图片的数字，最后一个数字，关闭进度圈.
                        String[] arrayList = sValueUpLoad.split(ConstantSign.SPLIT_SYMBOL);

                        if (arrayList != null) {

                            String indexPositon = arrayList[0];
                            String fileUrlUpLoad = arrayList[1];

                            method_single_image_addSubmit_upLoad(Integer.parseInt(indexPositon), fileUrlUpLoad, _actionItemOrFooterView, _fileType, listUpLoad.size());

                        }

                    }
                }, new Consumer<Throwable>() {
                    @Override
                    public void accept(Throwable throwable) throws Throwable {
                        if (throwable != null) {
//                            LogUtils.d(ConstantSign.LOGCAT_NOMAL, "执行了获取报错--->" + throwable.getMessage());
                        }
                    }
                }));


//        LogUtils.d(ConstantSign.LOGCAT_NOMAL, "执行了--addLocalFileStartUpload---addLocalFileStartUpload---addLocalFileStartUpload");

        //----------------------------------------------------------------------------------------------------------------------------------------------

    }

    /**
     * @param _filePathLocal          图片的本地地址信息，
     * @param _actionItemOrFooterView 需要区分这个上传是 上传item信息 还是上传footerview的信息
     */
    private void method_single_image_addSubmit_upLoad(int indexPosition, String _filePathLocal, int _actionItemOrFooterView, int _fileType, int _fileSize) {

        HashMap<String, Object> map = new HashMap<>();
        //map.put(Parameterkey.file, _filePathLocal);//
        map.put(Parameterkey.imageFile, _filePathLocal);//

        if (_fileType == ConstantApi.SKIP_TYPE) {
//            map.put(Parameterkey.fileType, ConstantApi.SKIP_TYPE_DEFAULT);//
            //不做上传的
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "ConstantApi.SKIP_TYPE--不添加类型上传");
        } else {
            map.put(Parameterkey.fileType, _fileType);//
        }

        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_UPLOADACCESSORY_URL);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.uploadAccessory_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);
        addLogUpLoadInfo.setHashMapParameter(map);

        //上传的是文件：
        MultipartBody.Builder multipartBodyBuilder = new MultipartBody.Builder()//
                .setType(MultipartBody.FORM);//

        File filUpLoad = new File(_filePathLocal);

        if (filUpLoad != null) {
            //是单个的文件，只需要添加一个即可
            multipartBodyBuilder.addFormDataPart(Parameterkey.imageFile, filUpLoad.getName(),//
                    RequestBody.create(filUpLoad, MediaType.parse(ApiService.MEDIATYPE_IMAGE_JPG)));//
        }

        if (_fileType == ConstantApi.SKIP_TYPE) {
            //不做上传的
//            multipartBodyBuilder.addFormDataPart(Parameterkey.fileType, String.valueOf(ConstantApi.SKIP_TYPE_DEFAULT));
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "RequestBody--ConstantApi.SKIP_TYPE--不添加类型上传");

        } else {
            multipartBodyBuilder.addFormDataPart(Parameterkey.fileType, String.valueOf(_fileType));
        }

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .uploadAccessory(multipartBodyBuilder.build())
                .compose(ArchiveFileAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))//
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<FileSingleUpLoadBean>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);

                        CommUtils.checkMaterialDialog(materialDialog);
//                        function_response_20002(serverCode, serverMessage, addLogUpLoadInfo, true);

                        if (!TextUtils.isEmpty(serverMessage)) {
                            ToastUtils.showShort(serverMessage);
                        } else {
                            ToastUtils.showShort(StringUtils.getString(R.string.uploaderrorstring));
                        }

                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {

//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "-----添加上传图片的接口---响应的------");
                        //需要添加进度圈圈吗？2024-2-23 10:38:50之前为何没有添加进度圈？
                        if (materialDialog == null) {
                            materialDialog = CommUtils.createMaterialDialog(mActivityInstance, ConstantSign.TIPS_UPLOAD);
                        }

                    }
                }).doFinally(new Action() {
                    @Override
                    public void run() throws Throwable {

                        CommUtils.checkMaterialDialog(materialDialog);
//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "图片上传完毕，必然要执行的--清空url信息");
                        //LogUtils.json(ConstantSign.LOGCAT_NOMAL,modifyMiddleTallItemWithMaskListener);
                        // TODO: 2024/2/23 9:09 对于即将上传的一堆儿附件的上传
                        method_test_upLoad_footer_hashMap();

                    }
                }).subscribe(new Consumer<FileSingleUpLoadBean>() {
                    @Override
                    public void accept(FileSingleUpLoadBean fileSingleUpLoadBean) throws Throwable {

//                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "添加上传图片的接口--响应的数据-->" + fileSingleUpLoadBean.getFileName());

                        if (fileSingleUpLoadBean != null) {

                            FileUpLoad fileUpLoad = new FileUpLoad();
                            //上传取  "urlSuffix":"null/20230818/2023081810312051410204.jpg"
                            fileUpLoad.setFilePath(fileSingleUpLoadBean.getUrlSuffix());
                            //fileUpLoad.setName(fileSingleUpLoadBean.getFileName().substring(fileSingleUpLoadBean.getFileName().lastIndexOf("/") + 1));

                            if (_actionItemOrFooterView == REQUEST_CODE_CHOOSE) {//如果是上传item的信息

                                if (agreenMentFileAddSubmitItemWithMaskListener != null) {
//
                                    HashMap<String, Object> hashMapTempItem = new HashMap<>();
                                    hashMapTempItem.put(Parameterkey.file_name, CommUtils.valueStringSplit(_filePathLocal));
                                    hashMapTempItem.put(Parameterkey.file_path_local, _filePathLocal);
                                    hashMapTempItem.put(Parameterkey.file_path_server, fileSingleUpLoadBean.getUrlSuffix());//后缀
                                    hashMapTempItem.put(Parameterkey.file_url_server, fileSingleUpLoadBean.getUrl());
                                    hashMapTempItem.put(Parameterkey.file_upload, fileUpLoad);

                                    //ArrayList<HashMap<String,Object>> hashMapListTemp = modifyMiddleTallItemWithMaskListener.getFileSingleUpLoadFiles_hashMap();
                                    if (agreenMentFileAddSubmitItemWithMaskListener.getFileSingleUpLoadFiles_hashMap() != null) {
                                        agreenMentFileAddSubmitItemWithMaskListener.getFileSingleUpLoadFiles_hashMap().add(hashMapTempItem);
                                    } else {
//                                        LogUtils.d(ConstantSign.LOGCAT_NOMAL+"modifyMiddleTallItemWithMaskListener.getFileSingleUpLoadFiles_hashMap() 是空值~");
                                    }

                                    method_test_upLoadHashMap(agreenMentFileAddSubmitItemWithMaskListener.getAgreenTime());

                                } else {
//                                    LogUtils.d(ConstantSign.LOGCAT_NOMAL + "uploadSingle---modifyMiddleTallItemWithMaskListener 是空值");
                                }

                            } else if (_actionItemOrFooterView == REQUEST_CODE_CHOOSE_FOOTERVIEW) {

                                //如果是上传footerview的附件信息
                                HashMap<String, Object> hashMapTempFooterFile = new HashMap<>();
                                hashMapTempFooterFile.put(Parameterkey.file_name, CommUtils.valueStringSplit(_filePathLocal));
                                hashMapTempFooterFile.put(Parameterkey.file_path_local, _filePathLocal);
                                hashMapTempFooterFile.put(Parameterkey.file_path_server, fileSingleUpLoadBean.getUrlSuffix());
                                hashMapTempFooterFile.put(Parameterkey.file_url_server, fileSingleUpLoadBean.getUrl());
                                hashMapTempFooterFile.put(Parameterkey.file_upload, fileUpLoad);
                                hashMapTempFooterFile.put(Parameterkey.file_file_type, footerArchiveFileTypeWithMaskListener.getFileType());//当前正在操作的类型
                                hashMapTempFooterFile.put(Parameterkey.file_file_type_name, footerArchiveFileTypeWithMaskListener.getFileTypeName());//当前正在操作的类型的名称和标题
                                hashMapTempFooterFile.put(Parameterkey.file_required, footerArchiveFileTypeWithMaskListener.isRequired());//当前附件是否必传

                                if (footerArchiveFileTypeWithMaskListener != null) {

                                    if (footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap() != null) {
                                        footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap().add(hashMapTempFooterFile);
                                    }

                                    //-------------------------------------------------------------------------------------------------------------
                                    //填充到外侧datas_archivetype之中去，
                                    Iterator<ArchiveFileType> iteratorArchiveFileType = mDataResources_archiveFile.iterator();

                                    if (iteratorArchiveFileType != null) {

                                        while (iteratorArchiveFileType.hasNext()) {

                                            ArchiveFileType item = iteratorArchiveFileType.next();

                                            if (item != null) {

                                                if (footerArchiveFileTypeWithMaskListener.getFileType() == item.getFileType()) {//判断条件 类型是否相等。
                                                    //执行的事情
//                                                    item = footerArchiveFileTypeWithMaskListener;
                                                    item.getFileSingleUpLoadFiles_hashMap().add(hashMapTempFooterFile);

                                                    LogUtils.json(ConstantSign.LOGCAT_NOMAL + "当前正在填充了图片之后的--ArchiveFileType-item是-->", item);

                                                    break;

                                                } else {
                                                    LogUtils.json(ConstantSign.LOGCAT_NOMAL + "不是这条附件动态类型的数据-->", item);
                                                }

                                            }
                                        }
                                    }

                                    //-------------------------------------------------------------------------------------------------------------

                                }

                                //一个外侧布局内部是分别他们的列表
//                               fileSingleUpLoadFiles_attachment_address_hashMap_dynamics.
//                               method_log_current_footer_hashMap(footerArchiveFileTypeWithMaskListener,footerArchiveFileTypeWithMaskListener.getFileSingleUpLoadFiles_hashMap());

                                // TODO: 2024/2/22 17:21 添加 总体放在一堆儿的上传信息；
                                if (fileSingleUpLoadFiles_attachment_address_hashMap_dynamics != null) {
                                    fileSingleUpLoadFiles_attachment_address_hashMap_dynamics.add(hashMapTempFooterFile);
                                }

                                // TODO: 2024/2/23 9:09 对于即将上传的一堆儿附件的上传
//                                method_test_upLoad_footer_hashMap();

                            }

                            //如果最后一张上传完毕，就关闭进度圈
                            if (indexPosition == _fileSize - 1) {
                                CommUtils.checkMaterialDialog(materialDialog);
                                //如果设置为空说明图片上传完毕，
                                materialDialog = null;
                            }

                        }
                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                        CommUtils.checkMaterialDialog(materialDialog);

                    }
                });


    }

    //该界面的各个列表的数据的提交：最终提交的，所有一堆儿一起提交：
    private void method_remedialItems_addSubmit_upLoad(ArrayList<ArchivesManageSingleUpLoad> _archivesManageList, //
                                                       ArrayList<InformationAccessoryUpLoad> _informationAccessoryList,//
                                                       ArrayList<FileCarInfoAddSubmitUpLoad> _fileCarInfoAddSubmitList) {//

        HashMap<String, Object> map = new HashMap<>();
        map.put(Parameterkey.shopInfoId, mSession.getShopInfoId());
        map.put(Parameterkey.clientManage, clientManage_upLoad);

        //--------------------------------------------------------------------
//        map.put(Parameterkey.vin, vin_upLoad);//车架号
//        map.put(Parameterkey.licenseNumber, licenseNumber_upLoad);//车牌号
//        map.put(Parameterkey.vehicleType, vehicleType_upLoad);//车辆类型
//        map.put(Parameterkey.carBranch, carBranch_upLoad);//品牌
//        map.put(Parameterkey.carSeries, carSeries_upLoad);//车系
//        map.put(Parameterkey.carModel, carModel_upLoad);//车型
//        map.put(Parameterkey.engineNum, engineNum_upLoad);//发动机号
        //--------------------------------------------------------------------

        map.put(Parameterkey.vehicleList, _fileCarInfoAddSubmitList);//车辆多车辆列表
        map.put(Parameterkey.archivesManageList, _archivesManageList);//合同列表
        map.put(Parameterkey.informationAccessoryList, _informationAccessoryList);//附件列表，档案附件，这里至少要添加附件类型和附件的列表。

        // TODO: 2024/2/22 20:19 这里至少要添加附件类型和附件的列表.待处理
        AddLogUpLoadInfo addLogUpLoadInfo = new AddLogUpLoadInfo();
        addLogUpLoadInfo.setActivity(mActivityInstance);
        addLogUpLoadInfo.setWhat(ConstantApi.WHAT_ADDINFORMATIONMANAGE_URL);//请求数字标识
        addLogUpLoadInfo.setUrlPath(ApiService.addInformationManage_url);//url地址
        addLogUpLoadInfo.setRequestMethod(ConstantSign.REQUEST_METHOD_POST);//POST 或者 GET
        addLogUpLoadInfo.setToastToUser(true);//展示给用户的标志
        addLogUpLoadInfo.setHashMapParameter(map);

        //上传的json内容是
        String jsonObject_UpLoad = JSON.toJSONString(map, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue);
        LogUtils.d(ConstantSign.LOGCAT_NOMAL, jsonObject_UpLoad);

        NetworkManager.getInstance().initRetrofitRxJava()
                .create(ApiService.class)
                .addInformationManage(RequestBody.create(jsonObject_UpLoad, MediaType.parse(ApiService.HEADER_JSON)))
                .compose(ArchiveFileAddSubmitActivity.this.bindUntilEvent(ActivityEvent.DESTROY))
                .compose(new ResponseTransformer<>(addLogUpLoadInfo, new ApiRequestSubListener<String>() {
                    @Override
                    public void handlerSomeThingNotSuccessDataForItSelf(int what_method, String serverCode, String serverMessage) {
                        super.handlerSomeThingNotSuccessDataForItSelf(what_method, serverCode, serverMessage);
                        CommUtils.checkMaterialDialog(materialDialog);
                    }
                })).doOnSubscribe(new Consumer<Disposable>() {
                    @Override
                    public void accept(Disposable disposable) throws Throwable {
                        method_create_materialDialog(mActivityInstance, ConstantSign.TIPS_SUBMIT);
                    }
                }).subscribe(new Consumer<String>() {
                    @Override
                    public void accept(String stringValue) throws Throwable {

                        CommUtils.checkMaterialDialog(materialDialog);

                        //TipDialog.show(StringUtils.getString(R.string.add_submit_success), WaitDialog.TYPE.SUCCESS);

                        //直接刷新 档案管理-主页列表；
                        EventLeadMain eventLeadMain = new EventLeadMain();
                        eventLeadMain.setMessage(ExtraValue.EVENTBUS_EVENT_TO_REFRESH_ARCHIVES_MAIN);
                        EventBus.getDefault().post(eventLeadMain);

                        methodSubmitSuccess(ArchiveFileAddSubmitActivity.this, new DoSomeThingListener() {
                            @Override
                            public void doSomeThing() {

                                //页面关闭直接回到档案管理主页列表页面
                                methodBack();

                            }
                        });

                    }
                }, new ErrorConsumer() {

                    @Override
                    protected void error(ApiException apiException) {

                        //添加提示，2023年11月6日10:53:05因为报错时候它是空白 没有提示的，最好给提示；
                        if (apiException != null) {
                            ToastUtils.showShort(apiException.getDisplayMessage());
                        }

                    }
                });


    }


//    @Override
//    public boolean onTouchEvent(MotionEvent event) {
////        if (keyboardUtil.isShow()) {
////            keyboardUtil.hideKeyboard();
////        }
//        return super.onTouchEvent(event);
//    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {

        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {

            method_check_back();

            return true;
        }

        return super.onKeyDown(keyCode, event);
    }

    //返回按钮的监听，或者软键盘的onkeydown监听
    private void method_check_back() {

        KeyboardUtils.hideSoftInput(ArchiveFileAddSubmitActivity.this);

//            if (keyboardUtil.isShow()) {
//                keyboardUtil.hideKeyboard();
//            }

        if (mPopupKeyboard != null) {

            if (mPopupKeyboard.isShown()) {

                mPopupKeyboard.dismiss(ArchiveFileAddSubmitActivity.this);
                mPopupKeyboard = null;

            } else {

                //未编辑完成，是否真的退出编辑
                CommUtils.checkDialog(mAlertView);

                mAlertView = new AlertView(ConstantSign.ALERT_TITLE,
                        getResources().getString(R.string.quit_current_edit),
                        getResources().getString(R.string.cancel),
                        new String[]{getResources().getString(R.string.quit_current_edit_sure)},
                        null,
                        ArchiveFileAddSubmitActivity.this,
                        AlertView.Style.Alert,
                        new OnItemClickListener() {
                            @Override
                            public void onItemClick(Object o, int position) {

                                if (position != AlertView.CANCELPOSITION) {

                                    methodBack();

                                }

                            }
                        });

                mAlertView.setCancelable(true).show();

            }

        } else {

            //未编辑完成，是否真的退出编辑
            CommUtils.checkDialog(mAlertView);

            mAlertView = new AlertView(ConstantSign.ALERT_TITLE,//
                    getResources().getString(R.string.quit_current_edit),//
                    getResources().getString(R.string.cancel),//
                    new String[]{getResources().getString(R.string.quit_current_edit_sure)}, //
                    null,
                    ArchiveFileAddSubmitActivity.this,
                    AlertView.Style.Alert,
                    new OnItemClickListener() {
                        @Override
                        public void onItemClick(Object o, int position) {

                            if (position != AlertView.CANCELPOSITION) {

                                methodBack();

                            }

                        }
                    });

            mAlertView.setCancelable(true).show();
        }

    }

    //打印单独的档案附件的合同
    private void method_log_current_footer_hashMap(ArchiveFileType _archiveFileType, ArrayList<HashMap<String, Object>> _fileSingleUpLoadFiles_hashMap_current) {

        for (HashMap<String, Object> hashMapItemFooter : _fileSingleUpLoadFiles_hashMap_current) {
            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "底部附件->" + _archiveFileType.getFileTypeName(), hashMapItemFooter);
        }

    }

    //底部附件资料的遍历
    private void method_test_upLoad_footer_hashMap() {

        for (HashMap<String, Object> hashMapItemFooter : fileSingleUpLoadFiles_attachment_address_hashMap_dynamics) {

            //取出当前的类型标题
            if (hashMapItemFooter != null) {
                LogUtils.json(ConstantSign.LOGCAT_NOMAL + "footer附件资料合一堆儿-->" + hashMapItemFooter.get(Parameterkey.file_file_type_name), hashMapItemFooter);
            }
        }

    }

    //添加上传的合同
    private void method_test_agreenMent_upLoad(ArrayList<ArchivesManageSingleUpLoad> _archivesManageList_out_upLoad) {

        for (ArchivesManageSingleUpLoad archivesManageSingleUpLoadItem : _archivesManageList_out_upLoad) {
            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "单个合同对象->", archivesManageSingleUpLoadItem);
        }

    }

    //列表 条目之中的对象；
    private void method_test_upLoadHashMap(String startTime) {

        //startTime 为了标识是哪个对象的图片;
        for (HashMap<String, Object> hashMapItem : agreenMentFileAddSubmitItemWithMaskListener.getFileSingleUpLoadFiles_hashMap()) {
            LogUtils.json(ConstantSign.LOGCAT_NOMAL + "对象->" + startTime, hashMapItem);
        }

    }

    /*
     * @Author:itchenqi175@163.com
     * @Time:2023-11-08  13:50
     * @Description:填充子类数值的适配器
     */
    private class SubMyArchiveFileCarInfoAddListener implements MyArchiveFileCarInfoAddListener {

        @Override
        public void chooseCarBranchType(int _identifierNumber, FileCarInfoAddSubmit fileCarInfoAddSubmit) {

            //选择车辆的品牌
            //在它之前有没有必选的
            KeyboardUtils.hideSoftInput(mActivityInstance);

            //监听品牌
            mCompositeDisposable.add(RxBus.getInstance()//
                    .toObserverable(RxBusCarBrand.class)//
                    .subscribeOn(AndroidSchedulers.mainThread())//
                    .observeOn(AndroidSchedulers.mainThread())//
                    .subscribe(new Consumer<RxBusCarBrand>() {//
                        @Override
                        public void accept(RxBusCarBrand rxBusCarBrand) throws Exception {

                            int actionFlag = rxBusCarBrand.getActionFlag();

                            CarBrandLargeCategory carBrandLargeCategory = rxBusCarBrand.getCarBrandLargeCategory();

                            if (actionFlag == ExtraValue.MODIFY_ARCHIVE_FILE_ADDSUBMIT_CARBRAND_SELECT) {//更改了店铺信息和重新存储id等

                                if (carBrandLargeCategory != null) {

                                    String carBranch_upLoad = carBrandLargeCategory.getCarBrandId();
                                    LogUtils.d("itchen---mCompositeDisposable---选中的 车辆品牌-->" + carBrandLargeCategory);

//                                    if (textVieweCarBrandModel != null) {
//                                        textVieweCarBrandModel.setText(carBrandLargeCategory.getCarBrandName());
//                                    }

                                    if (TextUtils.isEmpty(carBranch_upLoad)) {
                                        //选择类型异常，请重新选择；
                                        CommUtils.checkDialog(mAlertView);
                                        mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.select_lead_carbrand_toast), true);
                                        mAlertView.show();
                                        return;
                                    }


                                    if (fileCarInfoAddSubmit != null) {
                                        fileCarInfoAddSubmit.setCarBranchId(carBrandLargeCategory.getCarBrandId());
                                        fileCarInfoAddSubmit.setCarBranchName(carBrandLargeCategory.getCarBrandName());

                                        //车辆品牌一旦切换，车系必须清空重置重新选择
                                        fileCarInfoAddSubmit.setCarSeriesId("");
                                        fileCarInfoAddSubmit.setCarSeriesName("");
                                    }

                                    if (archiveFileCarInfoAddSubmitAdapter != null) {

                                        //刷新适配器，而且是刷新小适配器-
                                        int indexPosition = archiveFileCarInfoAddSubmitAdapter.getItemPosition(rxBusCarBrand.getFileCarInfoAddSubmit()) + archiveFileCarInfoAddSubmitAdapter.getHeaderLayoutCount();
                                        //find品牌信息
                                        TextView textViewBrandModel = (TextView) archiveFileCarInfoAddSubmitAdapter.getViewByPosition(indexPosition, R.id.textviewebrandmodel);
                                        CommUtils.setText(textViewBrandModel, carBrandLargeCategory.getCarBrandName());

//                                        if (textViewBrandModel != null) {
//                                            textViewBrandModel.post(new Runnable() {
//                                                @Override
//                                                public void run() {
//                                                    CommUtils.setText(textViewBrandModel, carBrandLargeCategory.getCarBrandName());
//                                                }
//                                            });
//
//                                        } else {
//                                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充合同-合同类型-textViewCarModelSecond--是空值");
//                                        }

                                    }

                                    if (mDataResources_carBrandSeriesList != null && !mDataResources_carBrandSeriesList.isEmpty()) {
                                        mDataResources_carBrandSeriesList.clear();
                                    }

                                    //-------------------------------------------------------------------------------------------------------------
                                    //选择完毕品牌立即调用车系
                                    gainCarBrandSeriesLineSmallCategory(carBrandLargeCategory.getCarBrandId(), null);

                                    //-------------------------------------------------------------------------------------------------------------

                                }

                            }
                        }
                    }));

            LeadsCarBrandLargeCategorySelectPopu leadsCarBrandLargeCategorySelectPopu = new LeadsCarBrandLargeCategorySelectPopu(ArchiveFileAddSubmitActivity.this,//
                    ExtraValue.MODIFY_ARCHIVE_FILE_ADDSUBMIT_CARBRAND_SELECT,//
                    mDataResources_carBrandLarge, fileCarInfoAddSubmit);

            leadsCarBrandLargeCategorySelectPopu.setTitleName(getResources().getString(R.string.add_submit_add_model_out));

            if (mDataResources_carBrandLarge != null && !mDataResources_carBrandLarge.isEmpty()) {

                //直接弹窗：
                basePopupView_carBrandLargeCategory = new XPopup.Builder(ArchiveFileAddSubmitActivity.this)
                        .hasShadowBg(true)
                        .moveUpToKeyboard(false) //如果不加这个，评论弹窗会移动到软键盘上面;
                        .isViewMode(true)
                        //.autoDismiss(false)
                        //.isDestroyOnDismiss(true) //对于只使用一次的弹窗，推荐设置这个
                        //.isThreeDrag(false) //是否开启三阶拖拽，如果设置enableDrag(false)则无效
                        //.dismissOnTouchOutside(true)
                        //.notDismissWhenTouchInView()
                        //.moveUpToKeyboard(false)
                        .asCustom(leadsCarBrandLargeCategorySelectPopu)//
                        .show();

            } else {

                //重新获取一遍接口；
                gainCarBrandLargeCategory(new GainDataCallBackListener() {
                    @Override
                    public void doSomeThing() {

                        //直接弹窗：
                        basePopupView_carBrandLargeCategory = new XPopup.Builder(ArchiveFileAddSubmitActivity.this)
                                .hasShadowBg(true)
                                .moveUpToKeyboard(false) //如果不加这个，评论弹窗会移动到软键盘上面;
                                .isViewMode(true)
                                //.autoDismiss(false)
                                //.isDestroyOnDismiss(true) //对于只使用一次的弹窗，推荐设置这个
                                //.isThreeDrag(false) //是否开启三阶拖拽，如果设置enableDrag(false)则无效
                                //.dismissOnTouchOutside(true)
                                //.notDismissWhenTouchInView()
                                //.moveUpToKeyboard(false)
                                .asCustom(leadsCarBrandLargeCategorySelectPopu)//
                                .show();

                    }
                });

            }

        }

        @Override
        public void chooseCarSeries(int _identifierNumber, FileCarInfoAddSubmit fileCarInfoAddSubmit) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "选中监听 车系 的全部监听");
            //在它之前有没有必选的
            KeyboardUtils.hideSoftInput(mActivityInstance);

            //监听车系
            mCompositeDisposable.add(RxBus.getInstance()//
                    .toObserverable(RxBusCarSeriesLineSmall.class)//
                    .subscribeOn(AndroidSchedulers.mainThread())//
                    .observeOn(AndroidSchedulers.mainThread())//
                    .subscribe(new Consumer<RxBusCarSeriesLineSmall>() {//
                        @Override
                        public void accept(RxBusCarSeriesLineSmall rxBusCarSeriesLineSmall) throws Exception {

                            int actionFlag = rxBusCarSeriesLineSmall.getActionFlag();

                            CarBrandSeriesLineSmallCategory carBrandSeriesLineSmallCategory = rxBusCarSeriesLineSmall.getCarBrandSeriesLineSmallCategory();

                            if (actionFlag == ExtraValue.MODIFY_LEAD_ARCHIVE_FILE_ADDSUBMIT_CAR_SERIES_SELECT) {//更改了店铺信息和重新存储id等

                                if (carBrandSeriesLineSmallCategory != null) {

                                    LogUtils.json("itchen---mCompositeDisposable---切换车辆品牌-车系-->", carBrandSeriesLineSmallCategory);

                                    //车系的id信息；
//                                   String carSeries_upLoad = carBrandSeriesLineSmallCategory.getCarSeriesId();
//                                    if (textViewCarModelSecond != null) {
//                                        textViewCarModelSecond.setText(carBrandSeriesLineSmallCategory.getCarSeriesName());
//                                    }

                                    if (fileCarInfoAddSubmit != null) {
                                        //设置选中的车系
                                        fileCarInfoAddSubmit.setCarSeriesId(carBrandSeriesLineSmallCategory.getCarSeriesId());
                                        fileCarInfoAddSubmit.setCarSeriesName(carBrandSeriesLineSmallCategory.getCarSeriesName());

                                    }

                                    //填充适配器的文字
                                    if (archiveFileCarInfoAddSubmitAdapter != null) {

                                        //刷新适配器，而且是刷新小适配器-
                                        int indexPosition = archiveFileCarInfoAddSubmitAdapter.getItemPosition(rxBusCarSeriesLineSmall.getFileCarInfoAddSubmit()) + archiveFileCarInfoAddSubmitAdapter.getHeaderLayoutCount();
                                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充车辆信息--车系--indexPosition-->" + indexPosition);

                                        //find品牌信息
                                        TextView textViewCarModelSecond = (TextView) archiveFileCarInfoAddSubmitAdapter.getViewByPosition(indexPosition, R.id.textviewcarmodelsecondcar);
                                        //第二种方式能直接填充
                                        if (textViewCarModelSecond != null) {

                                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充车辆信息--车系--textViewCarModelSecond--不是空值");
                                            textViewCarModelSecond.setText(carBrandSeriesLineSmallCategory.getCarSeriesName());

                                        } else {
                                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充车辆信息--车系--textViewCarModelSecond--是空值；");
                                        }

                                        //2023年11月8日16:50:48 该方式我发现不能有效的填充数据，是否是要刷新适配器？
//                                        if (textViewCarModelSecond != null) {
//                                            textViewCarModelSecond.post(new Runnable() {
//                                                @Override
//                                                public void run() {
//                                                    CommUtils.setText(textViewCarModelSecond, carBrandSeriesLineSmallCategory.getCarBrandName());
//                                                }
//                                            });
//
//                                        } else {
//                                            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充车辆信息--车系--textViewCarModelSecond--是空值");
//                                        }

                                    } else {
                                        LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填充车辆信息--车系--archiveFileCarInfoAddSubmitAdapter--是空值");
                                    }
                                }
                            }
                        }
                    }));


            //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
            //如果车辆品牌的id是空值，或者品牌的名称是空值：，那么必须弹窗提示先选择车辆品牌，才能接着获取车辆系的数据
            if (TextUtils.isEmpty(fileCarInfoAddSubmit.getCarBranchId()) || TextUtils.isEmpty(fileCarInfoAddSubmit.getCarBranchName())) {
                CommUtils.checkDialog(mAlertView);
                mAlertView = CommUtils.method_showAlertViewSingleSlowly(mActivityInstance, ConstantSign.ALERT_TITLE, getString(R.string.add_submit_add_model_out), true);
                mAlertView.show();
                return;
            }
            //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

            LeadsCarBrandSeriesLineSmalCategorySelectPopu leadsCarBrandSeriesLineSmalCategorySelectPopu = new LeadsCarBrandSeriesLineSmalCategorySelectPopu(ArchiveFileAddSubmitActivity.this,//
                    ExtraValue.MODIFY_LEAD_ARCHIVE_FILE_ADDSUBMIT_CAR_SERIES_SELECT,//
                    mDataResources_carBrandSeriesList, fileCarInfoAddSubmit);

            leadsCarBrandSeriesLineSmalCategorySelectPopu.setTitleName(getResources().getString(R.string.car_choose_car_line));

            //必选车辆品牌；
            if (mDataResources_carBrandSeriesList != null && !mDataResources_carBrandSeriesList.isEmpty()) {

                //直接弹窗：
                basePopupView_carBrandSeriesSmallCategory = new XPopup.Builder(ArchiveFileAddSubmitActivity.this)
                        .hasShadowBg(true)
                        .moveUpToKeyboard(false) //如果不加这个，评论弹窗会移动到软键盘上面;
                        .isViewMode(true)
                        //.autoDismiss(false)
                        //.isDestroyOnDismiss(true) //对于只使用一次的弹窗，推荐设置这个
                        //.isThreeDrag(false) //是否开启三阶拖拽，如果设置enableDrag(false)则无效
                        //.dismissOnTouchOutside(true)
                        //.notDismissWhenTouchInView()
                        //.moveUpToKeyboard(false)
                        .asCustom(leadsCarBrandSeriesLineSmalCategorySelectPopu)//
                        .show();

            } else {

                //车系-重新获取一遍接口；
                gainCarBrandSeriesLineSmallCategory(fileCarInfoAddSubmit.getCarBranchId(), new GainDataCallBackListener() {
                    @Override
                    public void doSomeThing() {

                        //直接弹窗：
                        basePopupView_carBrandSeriesSmallCategory = new XPopup.Builder(ArchiveFileAddSubmitActivity.this)
                                .hasShadowBg(true)
                                .moveUpToKeyboard(false) //如果不加这个，评论弹窗会移动到软键盘上面;
                                .isViewMode(true)
                                //.autoDismiss(false)
                                //.isDestroyOnDismiss(true) //对于只使用一次的弹窗，推荐设置这个
                                //.isThreeDrag(false) //是否开启三阶拖拽，如果设置enableDrag(false)则无效
                                //.dismissOnTouchOutside(true)
                                //.notDismissWhenTouchInView()
                                .asCustom(leadsCarBrandSeriesLineSmalCategorySelectPopu)//
                                .show();

                    }
                });

            }

        }

        @Override
        public void inputCarModel(int _identifierNumber, String _inputCarModel, FileCarInfoAddSubmit fileCarInfoAddSubmit) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "选中监听 输入车辆车型 的全部监听-->" + _inputCarModel);

            //输入车型的名称
            if (fileCarInfoAddSubmit != null) {
                fileCarInfoAddSubmit.setCarModelName(_inputCarModel);
            }

            //if (mDataResources != null && !mDataResources.isEmpty()) {
//                for (int indexPosition = 0; indexPosition < mDataResources.size(); indexPosition++) {
//                    ModifyMiddleTallAddSubmit modifyMiddleTallAddSubmit = mDataResources.get(indexPosition);
//                    if (_identifierNumber == modifyMiddleTallAddSubmit.getIdentifierNumber()) {
//                        modifyMiddleTallAddSubmit.setCustomerPersonName(_textViewAfterTextChangeEvent);
//                        mDataResources.set(indexPosition, modifyMiddleTallAddSubmit);
//                        break;
//                    }
//                }
//            }

        }

        @Override
        public void inputCarVin(int _identifierNumber, String _inputCarVin, FileCarInfoAddSubmit fileCarInfoAddSubmit) {

            //监听绑定的车牌号
            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填写监听 输入的车架子号-->" + _inputCarVin);

            if (fileCarInfoAddSubmit != null) {
                fileCarInfoAddSubmit.setVin(_inputCarVin);
            }

        }

        //传递适配器过来的车牌号录入的软键盘，做返回关闭软键盘用的
        @Override
        public void sendCarLicenseNumberPopupKeyboard(int _identifierNumber, FileCarInfoAddSubmit fileCarInfoAddSubmit, PopupKeyboard _popupKeyboard) {

            if (_popupKeyboard != null) {
                mPopupKeyboard = _popupKeyboard;
            }

        }

        @Override
        public void inputCarLicenseNumber(int _identifierNumber, String _inputCarLicenseNumber, FileCarInfoAddSubmit fileCarInfoAddSubmit) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填写监听 输入的车牌号-->" + _inputCarLicenseNumber);

            if (fileCarInfoAddSubmit != null) {
                fileCarInfoAddSubmit.setLicenseNumber(_inputCarLicenseNumber);
            }

        }


        @Override
        public void inputCarEngineNum(int _identifierNumber, String _inputCarEngineNum, FileCarInfoAddSubmit fileCarInfoAddSubmit) {

            LogUtils.d(ConstantSign.LOGCAT_NOMAL + "填写监听 输入的车牌号-->" + _inputCarEngineNum);

            if (fileCarInfoAddSubmit != null) {
                fileCarInfoAddSubmit.setEngineNum(_inputCarEngineNum);
            }

        }

        @Override
        public void deleteCarInfo(int _identifierNumber, FileCarInfoAddSubmit _fileCarInfoAddSubmit) {

            if (_fileCarInfoAddSubmit != null) {

                //做删除内容
                CommUtils.checkDialog(mAlertView);

                mAlertView = CommUtils.method_showAlertViewTwoButton(mActivityInstance,//
                        StringUtils.getString(R.string.clearcachecancel),//取消
                        StringUtils.getString(R.string.clearcachedelete),//删除
                        StringUtils.getString(R.string.deletesuremessage),//确定删除吗
                        false, new OnItemClickListener() {//
                            @Override
                            public void onItemClick(Object o, int position) {

                                if (position != AlertView.CANCELPOSITION) {

                                    if (mDataResources != null && !mDataResources.isEmpty()) {

                                        if (_fileCarInfoAddSubmit != null) {

                                            if (archiveFileCarInfoAddSubmitAdapter != null) {
                                                archiveFileCarInfoAddSubmitAdapter.remove(_fileCarInfoAddSubmit);
                                            }

                                        } else {
                                            ToastUtils.showShort(R.string.deletelowabnomal);
                                        }
                                    }
                                }
                            }
                        });

                mAlertView.show();

            }

        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        if (carBrandLargeCategory_defaultOne != null) {
            carBrandLargeCategory_defaultOne = null;
        }

        if (basePopupViewGender != null) {
            basePopupViewGender.onDestroy();
            basePopupViewGender = null;
        }

        //弹窗签约合同时间的
        if (basePopupViewAgreenmentTime != null) {
            basePopupViewAgreenmentTime.onDestroy();
            basePopupViewAgreenmentTime = null;
        }

        //选择合同的类型
        if (basePopupView_agreeMentType != null) {
            basePopupView_agreeMentType.onDestroy();
            basePopupView_agreeMentType = null;
        }

        if (myArchiveFileAddSubmitListener != null) {
            myArchiveFileAddSubmitListener = null;
        }

        if (mGlobalSetting != null) {
            mGlobalSetting.onDestroy();
            mGlobalSetting = null;
        }

        if (mGlobalSettingFooterView != null) {
            mGlobalSettingFooterView.onDestroy();
            mGlobalSettingFooterView = null;
        }

        //做一些内存释放的信息；
        if (basePopupView_carBrandLargeCategory != null) {
            basePopupView_carBrandLargeCategory.onDestroy();
            basePopupView_carBrandLargeCategory = null;
        }

        if (basePopupView_carBrandSeriesSmallCategory != null) {
            basePopupView_carBrandSeriesSmallCategory.onDestroy();
            basePopupView_carBrandSeriesSmallCategory = null;
        }

        if (mDataResources != null && !mDataResources.isEmpty()) {
            mDataResources.clear();
        }

        if (agreenMentFileAdapter != null) {
            agreenMentFileAdapter.notifyDataSetChanged();
            agreenMentFileAdapter = null;
        }

        if (mDataResources != null) {
            mDataResources = null;
        }

        if (mDataResourceCars != null && !mDataResourceCars.isEmpty()) {
            mDataResourceCars.clear();
            mDataResourceCars = null;
        }

        if (mDataResources_carBrandLarge != null && !mDataResources_carBrandLarge.isEmpty()) {
            mDataResources_carBrandLarge.clear();
            mDataResources_carBrandLarge = null;
        }

        if (mDataResources_archiveFile != null && !mDataResources_archiveFile.isEmpty()) {
            mDataResources_archiveFile.clear();
            mDataResources_archiveFile = null;
        }

        if (mDataResources_carBrandSeriesList != null && !mDataResources_carBrandSeriesList.isEmpty()) {
            mDataResources_carBrandSeriesList.clear();
            mDataResources_carBrandSeriesList = null;
        }

        if (mDataResources_archiveTypeList_forPopu != null && !mDataResources_archiveTypeList_forPopu.isEmpty()) {
            mDataResources_archiveTypeList_forPopu.clear();
            mDataResources_archiveTypeList_forPopu = null;
        }

        if (mDataResources_genderType != null && !mDataResources_genderType.isEmpty()) {
            mDataResources_genderType.clear();
            mDataResources_genderType = null;
        }

        if (mPopupKeyboard != null) {
            mPopupKeyboard.dismiss(ArchiveFileAddSubmitActivity.this);
        }

//        if (keyboardUtil != null) {
//            keyboardUtil.hideKeyboard();
//            keyboardUtil = null;
//        }


    }

    @Override
    protected void methodBack() {
        if (ActivityUtils.isActivityAlive(this)) {
            ActivityUtils.finishActivity(this);
        }
    }


}